Editor Formatter Issue

Hi,
I am facing the kind of same problem. I have used SpacingBuilder for created spacing between line breaks between two tokens. I am able to provide line breaks between two tokens but after line break the next token should take some space.
I have provided Alignment.createAlignment() but it is aligning next token in the same line.

Can you help me to solve this issue.

e.g.







0
3 comments

Hey,

I have/had the same issues, I forward my forums entry, there a multiple suggestions on how to solve this. I did not try the last thing as it is too much of a overall change, but maybe something of that works out for you. 

And if you try that last thing, please let me know if it works for you!

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206777749-Formatter-and-Indentation

And, another thing, if you don't want to work "pixel perfect" with spaces, you could work with indentation (that is what I have tried, too)

0
Avatar
Rustam Vishniakov

If a formatting block starts on the new line, it's position is controlled by indentation, not spacing. The core Block interface has two different methods: getSpacing() and getIndent(). The latter should return an indent usually relative to block's parent, for example returning Indent.getNormalIndent() will indent the block relative to its parent to the number of spaces defined in "Indent" option.

0

Hi,

I have provided indent now and also created code style settings which has indent setting to 2. But the problem is in some cases indent applied with 2 spaces but sometimes it increases to more than 2 spaces, sometimes it is increased to even 12 spaces.

Can you tell me, how exactly indent settings are applied or indentation works or how to solve the above problem.

 

Thanks

Ishan Jain

0

Please sign in to leave a comment.