| Summary: | [formatter] Code Formatter: Missing options for line wraps | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Kai Hofmann <powerstat> | ||||
| Component: | Core | Assignee: | Frederic Fusier <frederic_fusier> | ||||
| Status: | RESOLVED WORKSFORME | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P5 | CC: | comp634, daniel_megert, tmp2 | ||||
| Version: | 3.2.2 | Keywords: | helpwanted | ||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
What are your settings on 'line wrapping'? Created attachment 44231 [details]
XML Formatter Profile
See previous attachement for my config. On the "New Lines" tab I have switched on everything in the block "Insert new line", aithin "Array Initializers" the "insert new line before closing brace of array initializer", and last but not least in "Annotations" the Insert new line after annotations. On the "Control Statement" Tab everything in the block "General". Within the "if else" block, only the "keep else if on one line". Is there some progress on this bug? it still exists in Eclipse 3.2.2 and makes using the CodeFormatter impossible. I now found the problem - "maximum line length" was set to 0 - which seems not to mean that the line length is "not limited" like in most tools. It seems to meen here something like "insert line break as soon as possible". So this will end in an philosphic discussion. So I would like to suggest the following: - Adding documentation for this - Thinking about the meaning of "0" as maximum line length (endless vs. as soon as possible) - Maybe an option to protect the "." against line breaks If you want the code in comment 0, why don't you simply disable the line wrapping? Why don't you simply implement request number 198074 ? That is, add an option to disable line wrapping, preserving the current line splits decided by the user. It's the default behavior of IDEA IntelliJ and the way I'd love to have it in Eclipse as well. See and vote for Bug 198074 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 This works using N20130110-2000: set 'Do not wrap' for 'Qualified invocations'. |
I configured the code formatter to create my personal style. This works good except for 2 things I found where it adds line wraps that I don't like: Eclipse generated: public void push( int elem) { fStack .addFirst(new Integer( elem)); } What I wanted: public void push(int elem) { fStack.addFirst(new Integer(elem)); } Within the options there is no setting to add/remove these line breaks (1. function declaration, 2. object/method call. This should be customizable via the "new lines" tab. I would call this a bug (and not a feature), because eclipse changes existing code without having asked to do so.