| Summary: | [formatter] Code Formatting: Line Wrapping. Maximum line width problem with method declarations. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Geoff Gibbs <geoff> | ||||||
| Component: | Core | Assignee: | Mateusz Matela <mateusz.matela> | ||||||
| Status: | CLOSED DUPLICATE | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P5 | CC: | Andrzej.Miazga, ben.arnold.spam, fractalVisionz, j.c.yip, juergenkrey, julien.henry, krzysztof.daniel, mateusz.matela, tmoore, wigbam | ||||||
| Version: | 3.1 | ||||||||
| Target Milestone: | 4.5 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Geoff Gibbs
Right now the final bracket is not part of the wrapping mecanism. *** Bug 135519 has been marked as a duplicate of this bug. *** By "bracket", I'm assuming you mean brace? At first I thought this was an off-by-one error since you can work around it by reducing your allowed line length by one. This one is high on the annoying list for me. Created attachment 50589 [details]
Java source affected by this bug
Here's an example of Java source affected by this bug. Note that on lines 49 & 50, the method parameter itself exceeds the maximum line length and is correctly wrapped, but line 58 is not wrapped despite exceeding the maximum line length with the space and { at the end of the line. Note that in this situation, I wouldn't want the { to be wrapped by itself, but rather I would want it to break at column 41 and wrap the method parameter onto the next line as with lines 49 & 50.
Created attachment 50594 [details]
Formatter settings for the previous attachment
I don't know if this bug was ever solved, but it has resurfaced in 3.2.2 [build M20070212-1330].
Here is my example. I have the line wrap set at 115. And here is the output:
<TAB>public ItemModel(String name, String description, double length, double width, double height, double strength) {
However, the output should be:
<TAB>public ItemModel(String name, String description, double length, double width, double height,
<TAB><TAB>double strength) {
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 There is a workaround: go to the 'Braces' tab while editing formatter select 'Next line on wrap' in the 'Method declaration' Then the opening brace will be moved to the next line if necessary. *** Bug 299473 has been marked as a duplicate of this bug. *** Still present in 4.4 This problem no longer occurs after the formatter redesign. *** This bug has been marked as a duplicate of bug 303519 *** |