Search code examples
javaeclipseeclipse-luna

Eclipse Luna – AutoIndent is inconsistent


I upgraded to Luna and have a problem with auto-formatting, more specifically auto-indentation. The About Eclipse dialog verifies that I am running 4.4.0.

When the code auto-indents on save, it seems to jump back and forth between two different ways of indenting it regarding the number of spaces. Note the level of indentation:

doSomething( "arg0",
    "arg1" );

and

doSomething( "arg0",
        "arg1" );

This is extremely annoying when using SCM like git. What's causing this? How can it be fixed?


Solution

  • I found this bug reported here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=434962

    The fix mentioned there is to uncheck "Correct indentation" in the save actions. Weirdly, it will still correct indentation, but the bug is gone.

    Update: Eclipse Mars also has some issues. One bug can be found here. As a workaround, see here how to use the old formatter in Mars.