Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369795

Summary: [Formatter] Using after() on Assignment objects in formatter has no effect
Product: [Modeling] TMF Reporter: John J. Camilleri <john>
Component: Xtext BacklogAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: horst, john, moritz.eysholdt
Version: 2.1.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description John J. Camilleri CLA 2012-01-26 07:23:46 EST
Build Identifier: Version: 3.7.1 Build id: M20110909-1335

In my grammar I have a rule like so:
[code]
Exp : k=ID '->' v=ID
[/code]
I want to implement my formatter to achieve the following:
[code]
aaa ->
  bbb
ccc ->
  ddd
eee ->
  fff
[/code]
Since there is no keyword after the second ID, in my formatter I tried something like the following:
[code]
c.setLinewrap().before(f.getExpRule());
Assignment k = f.getExpAccess().getVAssignment_0_2();
c.setLinewrap().before(k);
c.setIndentationIncrement().before(k);
c.setLinewrap().after(k);
c.setIndentationDecrement().after(k);
[/code]
While the "before" rules seem to work fine, the "after" rules do not seem to work on [font=Courier]Assignment[/font] objects. Thus my indentation is never decremented and I end up with the following:
[code]
aaa ->
  bbb
  ccc ->
    ddd
    eee ->
      fff
[/code]

Reproducible: Always

Steps to Reproduce:
1. As description above
Comment 1 Andreas Horst CLA 2014-05-23 09:44:21 EDT
Build id: 4.3.2.M20140221-1700

I can confirm this behavior for Xtext SDK 2.5.4.v201404100756. The proposed solution (http://www.eclipse.org/forums/index.php/mv/msg/279480/783780/#msg_783780) to use the respective rule call element of the assignment instead of the assignment element has no effect.
Comment 2 Moritz Eysholdt CLA 2016-07-21 05:31:53 EDT
won't fix because it affects the old formatter infrastructure