| Summary: | Auto indent puts 4 sapces after parentheses while indent is set to 2 space | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Amir Karimi <a.karimi.k> |
| Component: | Text | Assignee: | JDT-Text-Inbox <jdt-text-inbox> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | manju656, markus.kell.r |
| Version: | 3.8 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
[1] System.out.println(|); Press 'Enter' at location marked with | gives:
System.out.println(
|);
[2] new Runnable() {|}; Press 'Enter' at location marked with | gives:
new Runnable() {
|
};
On analysis, the indentation after parenthesis is computed in JavaIndenter#createReusingIndent => fPrefs.prefIndentationSize * additional where:
fPrefs.prefIndentationSize => 'Indentation size' from the 'Indentation' tab
additional => 'Default indentation for wrapped lines' from the 'Line Wrapping' tab.
If 'Default indentation for wrapped lines' from the 'Line Wrapping' tab is set to '1', then case [1] behaves same as case [2].
@Markus: Is this the intended behavior?
@Manju - Thanks! Setting 'Default indentation for wrapped lines' to 1 solved the problem. It was 2 by default. > @Markus: Is this the intended behavior?
Yes.
|
I've changed the indention for Java formatter to 2 spaces. But auto indention put 4 spaces when I hit enter after a parenthesis; Ok( _ <- Caret is here ) But I have no problem with braces; def A = { _ <- Caret is here } I code in Scala but the problem is produced in Java as well.