Community
Participate
Working Groups
As in: http://www.eclipse.org/forums/index.php?t=msg&goto=528455& please support the ability to specify before/after for indentation elements so that e.g in keyword expression a line break can be specified after "keyword" indentation can be specified to start before "expression" indentation can be specified to stop after "expression" ensuring that a substantial "expression" appears indented.
Fixed in head. You can now specify indentation as follows: cfg.incrementIndentation().after(f.getXAccess().getLeftCurlyBracketKeyword_1()); cfg.decrementIndentation().before(f.getXAccess().getRightCurlyBracketKeyword_3());
Wow, that was quick, unfortunately it doesn't work. The following manually formatted CompleteOCL context Transaction inv invariant_Transaction1 : self.oclIsKindOf(Transaction) = true inv invariant_Transaction3 : self.oclIsTypeOf(Burning) = false inv invariant_Transaction2 : self.oclIsTypeOf(Transaction) = true inv invariant_Transaction4 : self.oclIsKindOf(Burning) = false context Transaction::program() : LoyaltyProgram reformats as context Transaction inv invariant_Transaction1: self.oclIsKindOf(Transaction) = true inv invariant_Transaction3: self.oclIsTypeOf(Burning) = false inv invariant_Transaction2: self.oclIsTypeOf(Transaction) = true inv invariant_Transaction4: self.oclIsKindOf(Burning) = false never decrementing. The formatting is: { InvCSElements a = f.getInvCSAccess(); c.setLinewrap(2).before(a.getInvKeyword_0()); setNoSpaceLineWrap(c, a.getColonKeyword_2()); c.setIndentationIncrement().before(a.getExpressionAssignment_3()); c.setIndentationDecrement().after(a.getExpressionAssignment_3()); // c.setLinewrap().after(a.getExpressionAssignment_3()); }
Hi Ed, could you post the involved grammar rules?
It's all in CVS at /org.eclipse.ocl.examples.xtext.completeocl/src/org/eclipse/ocl/examples/xtext/completeocl/CompleteOCL.xtext. A build (generated with RC1) against Xtext RC2a is at https://build.eclipse.org/hudson/job/cbi-mdt-ocl-3.0/251/artifact/build/N201005261618/ I suspect that the salient challenges are that a.getExpressionAssignment_3() is a complex rule which terminates with backtracking after exhaustion of options is inherited from /org.eclipse.ocl.examples.xtext.essentialocl/src/org/eclipse/ocl/examples/xtext/essentialocl/EssentialOCL.xtext
we won't be able to solve this during the RC phase.
won't fix because it affects the old formatter infrastructure