Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369795 - [Formatter] Using after() on Assignment objects in formatter has no effect
Summary: [Formatter] Using after() on Assignment objects in formatter has no effect
Status: CLOSED WONTFIX
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext Backlog (show other bugs)
Version: 2.1.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-26 07:23 EST by John J. Camilleri CLA
Modified: 2016-07-21 05:31 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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