Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347530 - [Formatter] Line length should count a tab character based on the number of spaces it represents
Summary: [Formatter] Line length should count a tab character based on the number of s...
Status: RESOLVED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext Backlog (show other bugs)
Version: unspecified   Edit
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-27 18:17 EDT by Mary Komor CLA
Modified: 2016-07-21 05:26 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 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