Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 156042 - [formatter] Line Wrapping: "wrap when necessary" with "indent on column" produces unwanted newlines
Summary: [formatter] Line Wrapping: "wrap when necessary" with "indent on column" prod...
Status: RESOLVED DUPLICATE of bug 303519
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P5 normal with 3 votes (vote)
Target Milestone: 4.5 M6   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard: To be verified for 4.6 M7
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-02 19:19 EDT by John McCall CLA
Modified: 2016-04-13 16:53 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John McCall CLA 2006-09-02 19:19:48 EDT
Consider a line like this:
  longObjectExpression.methodCall(foo, bar, baz);
with "Line Wrapping -> Function Calls -> Arguments" configured as follows:
  Wrap only when necessary
  Indent on column
  Don't force split

Now suppose that the call and its first argument, i.e.
  longObjectExpression.methodCall(foo,
exceed the line limit all by themselves.  Eclipse is currently formatting this as:
  longObjectExpression.methodCall(
                                  foo,

Since the "indent on column" rule is forcing a long line anyway, the newline is simply unnecessary vertical whitespace.  The first argument should appear on the method-call line unless "Force Split" is selected.

Analogous problems occur with constructor calls, with constructor and method declarations, with 'throws' clauses everywhere, with enum arguments, etc.
Comment 1 Creo Ilbe CLA 2007-11-05 07:53:41 EST
See and vote for Bug 198074
Comment 2 paul stanton CLA 2007-11-28 19:51:37 EST
what causes this:
http://img505.imageshack.us/img505/4162/formatteryx2.gif

if it's not a bug, how do i stop it?
Comment 3 Frederic Fusier CLA 2008-08-18 08:07:31 EDT
Ownership has changed for the formatter, but I surely will not have enough time to fix your bug during the 3.5 development process, hence set its priority to P5.
Please provide a patch if you definitely need the bug to be fixed in this version and I'll have a look at it...
TIA
Comment 4 Mateusz Matela CLA 2016-04-13 16:31:52 EDT
This problem no longer occurs after the formatter redesign.

*** This bug has been marked as a duplicate of bug 303519 ***