| [Xtext formatting] Ignore indentation in special cases and how to disable autowrap [message #730970] |
Thu, 29 September 2011 11:58  |
Michael Ernst Messages: 46 Registered: July 2010 |
Member |
|
|
Hi,
I created a formatter for my language definition by inheriting from AbstractDeclarativeFormatter. In the default generated formatter the following pattern is used for selecting pairs for indentation:
for( Pair<Keyword, Keyword> pair : f.findKeywordPairs( "{", "}" ) )
Is there a way to filter the result because I use also the curly brackets for array initialization.
I fixed this by introducing a terminal rule for the curly brackets and define the behaviour for each bracket occurence but when doing so I have to define it this way:
c.setLinewrap().after( f.get...().getOPEN_CURLY_BRACKETTerminalRuleCall_5() );
c.setIndentationDecrement().before(...
c.setIndentationDecrement().before(...
Thats ok, but when I make changes in my grammer definition, it is possible that the numbers at end changes which leads to compile errors.
Is there a better way?
Another question is how to disable the autowrap functionality in a global scope. The documentation says that it can be overridden for local elements. Isn't there a global setting?
Kind regards
Michael
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01814 seconds