In my DSL I have () for a lot of stuff for example if conditions and some declarations such as block(a;b;c;d;);
In my configureFormatting function I do this in the following order:
for (Pair<Keyword, Keyword> pair : grammarAccess.findKeywordPairs("(", ")"))
{
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
c.setIndentation(block.getLeftParenthesisKeyword(),block.getRightParenthesisKeyword());
c.setLinewrap().after(block.getLeftParenthesisKeyword());
c.setLinewrap().before(block.getRightParenthesisKeyword());
Expected is:
block (
int z;
int a;
int y;
);
if (a = 1)
Actual Result:
block (int z;
int a;
int y;);
if (a = 1)
Well I have figured it out. It was simple. I made the following: