Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338637 - [Formatting] Formatting issue with comma-separated lists
Summary: [Formatting] Formatting issue with comma-separated lists
Status: RESOLVED WONTFIX
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext Backlog (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Karsten Thoms CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-02 05:00 EST by Jose Carlos CLA
Modified: 2016-09-20 08:31 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jose Carlos CLA 2011-03-02 05:00:42 EST
Build Identifier: 20100917-0705

It's a bug related to a post in the xtext forum: http://www.eclipse.org/forums/index.php?t=msg&S=f99336c0482f91bbef398fc7a7547a8d&th=204862

With this grammar:

Root     : model+=MyModel* ;
MyModel  : head=Head "[" ( body=Body )? "]";
Head     : name+=Tag ( ',' name+=Tag )* ;
Tag      : name+=TagImpl+;
TagImpl  : name=ID;
Body     : name+=BodyImpl+;
BodyImpl : name=ID "=" (value=ID)? ";"  ;

and these formatting rules:

c.setLinewrap().after             ( g.getMyModelAccess().getLeftSquareBracketKeyword_1() );
c.setIndentationIncrement().after ( g.getMyModelAccess().getLeftSquareBracketKeyword_1() );

c.setLinewrap().before             ( g.getMyModelAccess().getRightSquareBracketKeyword_3() );
c.setIndentationDecrement().before ( g.getMyModelAccess().getRightSquareBracketKeyword_3() );
c.setLinewrap().after              ( g.getMyModelAccess().getRightSquareBracketKeyword_3() );

I expect something like:

one , two three [
    four = five ;
]
six seven [
    eight = nine ;
]

but the result is:

one , two three [
    four = five ;
] six seven [
    eight = nine ;
]



The error happens when the "Head" model contains more than one "Tag" model, which is represented as a comma separated list. If "Head" is composed by only one "Tag" model containing several "TagImpl" models (so there's no commas) everything is correct.

Reproducible: Always

Steps to Reproduce:
a) Include several "Tag" models in a "Head" model and the formatting is wrong
b) With only one "Tag" model (no commas in "Head") the formatting is correct
Comment 1 Jose Carlos CLA 2011-03-02 05:02:39 EST
It happens in Xtext 1.0.1 and 1.0.2
Comment 2 Karsten Thoms CLA 2016-09-20 08:30:47 EDT
This bug is related to the deprecated formatter API.