| Summary: | [formatter/matcher] Support before/after indentation -> problem with matcher remaining | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Ed Willink <ed> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | moritz.eysholdt, stephane, sven.efftinge |
| Version: | 1.0.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows Vista | ||
| Whiteboard: | |||
|
Description
Ed Willink
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 |