Hey. I have a slight problem with code formatting in my DSL. Assume this file contents:
/**
* comment
*/
persistent XX {
/**
* asd
*/
data-category XX;
/**
* more comment
*/
attribute xx : common.BOOLEAN {
property label "Something";
}
}
running the code formatter with this config:
override protected void configureFormatting(FormattingConfig c) {
c.setAutoLinewrap(120);
for (pair : ga.findKeywordPairs("{", "}")) {
c.setNoLinewrap.before(pair.first);
c.setLinewrap(1, 1, 1).after(pair.first);
c.setLinewrap(1, 1, 2).before(pair.second);
c.setLinewrap(1, 1, 2).after(pair.second);
c.setIndentationIncrement.after(pair.first);
c.setIndentationDecrement.before(pair.second);
}
for (kw : ga.findKeywords(";")) {
c.setLinewrap(1, 1, 2).after(kw);
c.setNoSpace.before(kw);
}
c.setNoLinewrap.before(ga.connectionAccess.toKeyword_4);
// 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(SL_COMMENTRule)
c.setLinewrap(0, 1, 2).before(ML_COMMENTRule)
c.setLinewrap(0, 1, 1).after(ML_COMMENTRule)
}
yields this weird formatted comments. what am i doing wrong?? xtext version is 2.6.0.
/**
* comment
*/
persistent XX {
/**
* asd
*/
data-category XX;
/**
* more comment
*/
attribute xx : common.BOOLEAN {
property label "Something";
}
}
Any hints? Will I have to write my own formatter without help from the declarative one?
Thanks!