Custom language formatter question pack #1
Hello.
First of all i wonder if the formatting is different if i return null from getFormattingModelBuilder or if i return this
FormattingModelProvider.createFormattingModelForPsiFile(
element.getContainingFile(),
null,
settings);
from my FormattingModelBuilder?
Secondly, what exactly is a formatting model and what is the difference with blocks?
And what Block do i need to pass to this FormattingModelProvider.createFormattingModelForPsiFile ?
Please sign in to leave a comment.
Hello Jay,
Why do you care? Neither of these is a valid implementation.
A formatting model contains a tree of blocks.
The block describing your entire file (with sub-blocks for AST nodes contained
in the file).
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
I care because right now i don't have time to validly implement the formatter, however i noticed that the second version ”doesn't work“ better than the first one.
Like when i don't have a FormattingModelBuilder at all and press enter, the new line's indent is different from the previous. Surprisingly this does not happen when i have a null Block.