Bug 83915 - [Code Formatter] Line Wrapping policy wrap only when necessary issue
Summary: [Code Formatter] Line Wrapping policy wrap only when necessary issue
Status: VERIFIED DUPLICATE of bug 264112
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal with 11 votes (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-28 05:32 EST by Ricardo Jorge PC de Almeida CLA
Modified: 2010-04-27 04:22 EDT (History)
9 users (show)

See Also:


Attachments
Eclipse breaking the line on method invocation... (8.19 KB, image/jpeg)
2005-01-28 05:56 EST, Ricardo Jorge PC de Almeida CLA
no flags Details
How eclipse should break the line (8.24 KB, image/jpeg)
2005-01-28 05:57 EST, Ricardo Jorge PC de Almeida CLA
no flags Details
Two rows that should wrap similarly (2.00 KB, text/plain)
2006-06-30 15:23 EDT, Will Budreau CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ricardo Jorge PC de Almeida CLA 2005-01-28 05:32:53 EST
In Code Formarter->Line Wrapping -> Function Calls, I've got all items set to
wrap only when necessary, but I don't think the code gets formated correctly, as
line is break well before it's necessary. For instance, supose code:

someObject.methodCall(arg1,arg2,arg3)

Eclipse formats to

someObject
   .methodCall(arg1,arg2,arg3)

instead of

someObject.methodCall(arg1,arg2,
                      arg3)

or similar...
Comment 1 Ricardo Jorge PC de Almeida CLA 2005-01-28 05:56:04 EST
Created attachment 17549 [details]
Eclipse breaking the line on method invocation...

This is the way eclipse breaks the line...
Comment 2 Ricardo Jorge PC de Almeida CLA 2005-01-28 05:57:12 EST
Created attachment 17550 [details]
How eclipse should break the line

This is the way I believe eclipse should break the line...
Comment 3 Rob Saccoccio CLA 2005-05-07 20:32:59 EDT
Is a fix for this expected to make it into 3.1?  
Comment 4 Hendrik Maryns CLA 2006-05-10 08:39:54 EDT
This only seems to occur in particular cases: if the line is much too long, it doesn’t.  For example, this:

function.addTransition(FunctionInputTuple.getInstance(
        neitherButBothEncountered, foundX, foundY), foundDominating);
function.addTransition(FunctionInputTuple.getInstance(
        neitherButBothEncountered, start, foundDominating), foundDominating);

where the print margin line is here:                               ^
(i.e. between the ) and ; of the second line)
gets reformatted to this:

function
        .addTransition(FunctionInputTuple.getInstance(
                neitherButBothEncountered, foundX, foundY),
                foundDominating);
function.addTransition(FunctionInputTuple.getInstance(
        neitherButBothEncountered, start, foundDominating),
        foundDominating);

So if it rags far enough over the border, it is put on the next line first, which makes the breaking before the method invocation unnecessary.

I can add screenshots if desired.
Comment 5 Olivier Thomann CLA 2006-05-25 10:32:48 EDT
*** Bug 143634 has been marked as a duplicate of this bug. ***
Comment 6 John Cortell CLA 2006-05-25 11:30:49 EDT
We consider this a fairly serious problem with the formatter. We just recently told our development team that they must run any source files they plan to commit to our source control system through the formatter first. We are having to rethink that directive now that we've discovered this.

Actually, the case I ran into is an extension of this problem, with even uglier results. In the case shown in bug 143634, it splits the line on the '.', but then the subsequent line is no closer to the left margin than it would be otherwise. So, the split does nothing to shorten the line; it simply splits it across two.

We are hoping this fixed before 3.2 goes final.
Comment 7 Olivier Thomann CLA 2006-05-25 11:35:07 EDT
This is too late for 3.2. We are in the end game. Only show stoppers will be considered at this stage.
Comment 8 Will Budreau CLA 2006-06-30 15:23:33 EDT
Created attachment 45617 [details]
Two rows that should wrap similarly

Eclipse inconsistently breaks the two lines at the method invocation
Comment 9 Olivier Thomann CLA 2007-06-21 11:33:25 EDT

*** This bug has been marked as a duplicate of bug 59891 ***
Comment 10 Will Budreau CLA 2007-07-23 15:12:27 EDT
None of the samples in bug 59891 include the cases described in the comments here.

Bug 5989 is about the aesthetics of where wrapping should occur.

This bug is about unnecessary line wraps where the following line is indented to the same position that it was wrapped from.
This provides no benefit.

Comment 11 Frederic Fusier CLA 2010-04-14 05:59:08 EDT
(In reply to comment #10)
> None of the samples in bug 59891 include the cases described in the comments
> here.
> 
> Bug 5989 is about the aesthetics of where wrapping should occur.
> 
> This bug is about unnecessary line wraps where the following line is indented
> to the same position that it was wrapped from.
> This provides no benefit.
>
I agree with this remark. 

(In reply to comment #9)
> 
> *** This bug has been marked as a duplicate of bug 59891 ***
It was in fact more a duplicate of bug 264112, hence it's fixed since 3.6M5.

*** This bug has been marked as a duplicate of bug 264112 ***
Comment 12 Srikanth Sankaran CLA 2010-04-27 02:33:26 EDT
Verified for 3.6M7 using build I20100424-2000