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

Bug 347530

Summary: [Formatter] Line length should count a tab character based on the number of spaces it represents
Product: [Modeling] TMF Reporter: Mary Komor <mkomor>
Component: Xtext BacklogAssignee: Project Inbox <tmf.xtext-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: chanskw, moritz.eysholdt
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Whiteboard:

Description Mary Komor CLA 2011-05-27 18:17:28 EDT
Build Identifier: 

It seems that a leading tab characters is counted as one unit/char when calculating the length of a line. It should be translated into the number of spaces that a tab character represents. 

(The following example was posted to the mailing list):
According to FormatterTest.testIndentationAndLineWrap() in the test suite, 
for the input

-----
"test indentation { void func(x:int,y:int,s:javalangString, foo:javasqlDate, 
blupp:mylongtype,  msads:adshdjkhsakdasdkslajdlsask, x:x, a:b, c:d ); }"
-----

if I use the following config:

-----
c.setAutoLinewrap(30);
// increment the indentation twice after a "{"
c.setIndentationIncrement().after(f.getTestIndentationAccess().getLeftCurlyBracketKeyword_1());
c.setIndentationIncrement().after(f.getTestIndentationAccess().getLeftCurlyBracketKeyword_1());
-----

then the actual result is as follows:

-----
1234567890123456789012345678901  <-- column indicator
test indentation {
        void func(x:int, y:int,  <-- line length is 31, should have been wrapped
        s:javalangString,
        foo:javasqlDate,
        blupp:mylongtype,
        msads:adshdjkhsakdasdkslajdlsask,
        x:x, a:b, c:d);
        }
-----



Reproducible: Always
Comment 1 Mary Komor CLA 2011-06-02 14:36:48 EDT
Switching from enhancement to defect. I think this is more a defect than an enhancement.
Comment 2 Mary Komor CLA 2011-06-23 17:51:20 EDT
Any chance this can be considered for 2.0 SR1?
Comment 3 Samantha Chan CLA 2011-08-10 11:43:39 EDT
Is it possible to target this for the next 2.0 SR?
Thanks!
Comment 4 Moritz Eysholdt CLA 2016-07-21 05:26:48 EDT
this is fixed in the new formatter infrastructure