Community
Participate
Working Groups
In the generated formatter the following code is produced: ----------------------------------------------------------------- // It's usually a good idea to activate the following three statements. // They will add and preserve newlines around comments // c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule()); // c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule()); // c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule()); ----------------------------------------------------------------- Uncommenting these lines leads to uncompilable code, since getSL_CommentRule() is not defined for IGrammarAccess. I propose to change the generator to inject the DSL's GrammarAccess and use this one. ----------------------------------------------------------------- import com.google.inject.Inject; import ....services.MyDslGrammarAccess; public class MyDslFormatter extends AbstractDeclarativeFormatter { @Inject private MyDslGrammarAccess grammarAccess; @Override protected void configureFormatting(FormattingConfig c) { // It's usually a good idea to activate the following three statements. // They will add and preserve newlines around comments // c.setLinewrap(0, 1, 2).before(grammarAccess.getSL_COMMENTRule()); // c.setLinewrap(0, 1, 2).before(grammarAccess.getML_COMMENTRule()); // c.setLinewrap(0, 1, 1).after(grammarAccess.getML_COMMENTRule()); } } -----------------------------------------------------------------
dup *** This bug has been marked as a duplicate of bug 329996 ***
Requested via bug 522520. -M.