| Summary: | [formatter] No option for inline braceless if statements (one line, not two) | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | John Doe <birds.o.feather> |
| Component: | Core | Assignee: | Mateusz Matela <mateusz.matela> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | mateusz.matela |
| Version: | 4.7.3 | ||
| Target Milestone: | 4.8 RC2 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
The setting is there in the Control Statements tab: Keep 'then' statement on same line. That option does not work. The 'then' statement is still moved to the second line. I have narrowed the scope from All/All to PC/Linux, since this is the Oxygen 4.7.3a 64-bit Linux tar.gz downloaded straight from the website. I found the problem. I had set Line Wrapping > Compact If-Else set to the following:
org.eclipse.jdt.core.formatter.alignment_for_compact_if=49
Wrap all elements, every element on a new line
Force split = yes
The Force Split was the culprit. Setting back to this:
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
Wrap where necessary
Force split = no
|
Why is there no option to leave braceless if statements on one line, not two? All of the following if (true) x = 0; if (true) return; if (true) throw new Exception(); if (true) while (true) { // do stuff } are incorrectly formatted as if (true) x = 0; if (true) return; if (true) throw new Exception(); if (true) while (true) { // do stuff } This was not a problem in the OldJavaFormatter.javaFormatter from Eclipse 3.*.