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

Bug 338916

Summary: Formatter: it should be possible to tell the formatter to never add or remove newlines (except for blank lines).
Product: [Eclipse Project] JDT Reporter: Geoffrey De Smet <ge0ffrey.spam>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Geoffrey De Smet CLA 2011-03-04 07:03:46 EST
Build Identifier: 20100917-0705

Suppose I have these 2 lines in a java file:

    private WorstScoreSolverBenchmarkComparator worstScoreSolverBenchmarkComparator
            = new WorstScoreSolverBenchmarkComparator();

then the eclipse formatter makes it 1 really long line.
In the formatter, I have set everything to "Do not wrap" and also checked "preserve new ... lines",

However, if I set the formatter to "always wrap", then he wraps similar lines incorrectly.

I want to do the wrapping manually:
If I did wrapping on a line, there should be wrapping. If I didn't, there shouldn't be wrapping.
Either way, eclipse's formatter should NEVER add or remove newlines (except to add or remove blank lines).

Reproducible: Always
Comment 1 Olivier Thomann CLA 2011-03-10 09:27:33 EST
Ayushman, please check this one. I thought we already have such an option.
Comment 2 Geoffrey De Smet CLA 2011-03-10 09:53:27 EST
The option exists: "Do not wrap" in conjunction with "preserve new ... lines".
But it does not keep its hand from my code: it still does unwrapping on some code.

I am looking for the option "NEVER add or remove a \n character" (AKA "keep your (un)wrapping hands from code" :)
Comment 3 Ayushman Jain CLA 2011-03-14 02:48:09 EDT
(In reply to comment #2)
> The option exists: "Do not wrap" in conjunction with "preserve new ... lines".
> But it does not keep its hand from my code: it still does unwrapping on some
> code.
> 
> I am looking for the option "NEVER add or remove a \n character" (AKA "keep
> your (un)wrapping hands from code" :)

I think the "never join already wrapped lines" option in "line wrapping" tab should cover this case, i.e. should not condense the given example to a single line since its already wrapped. But strangely, it doesn't.
Comment 4 Eclipse Genie CLA 2020-01-24 08:39:31 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.