Community
Participate
Working Groups
Build Identifier: M20100211-1343 Given the following Xtext grammar: grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" Model : (elements+=Element)+ ( c='c' & (d='d' )? ) ; Element : '(' (AElement | BElement) ')' ; AElement : elem='a'; BElement : elem='b'; and the following formatter rules defined in method configureFormatting: ModelElements modelAccess = f.getModelAccess(); c.setLinewrap().before(modelAccess.getCCKeyword_1_0_0()); c.setLinewrap().before(modelAccess.getDDKeyword_1_1_0()); ElementElements elementAccess = f.getElementAccess(); c.setNoSpace().around(elementAccess.getLeftParenthesisKeyword_0()); c.setNoSpace().around(elementAccess.getRightParenthesisKeyword_2()); and the following model: (a)(b) c I would execpt that formatting has no effect, i.e. that the model is already correctly formatted. But the outcome is the following: (a)(b)c Is this a bug? I would have expected a linewrap before 'c'. Reproducible: Always Steps to Reproduce: 1. Define grammar 2. Implement formatter 3. Create 'test.mydsl' and format given text
This issue applies to Xtext RC1.
Sounds like a Bug. Could you check whether c.setLinewrap().before(modelAccess.getCAssignment_...()); or c.setLinewrap().before(modelAccess.getGroup_2()); // The group which contains the assignments. has the desired effect and could be a workaround?
Unfortunately none of the suggested workarounds work :-(
*** Bug 314034 has been marked as a duplicate of this bug. ***
won't fix because it affects the old formatter infrastructure