-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong indentation of single statement ifs/etc #239
Comments
Just double-checking, do you have the option "Enter key adjusts the indentation on the new line" checked in Preferences > Java > Editor > Typing? |
This test should confirm your issue void testIndentAfterIfStatement() {
makeEditor("""\
class Bagaga {
def foo(def a, def b) {
if (a == b)${CARET}
}
}
""".stripIndent())
send('\n')
assertEditorContents("""\
class Bagaga {
def foo(def a, def b) {
if (a == b)
${CARET}
}
}
""".stripIndent())
} It currently fails, just as you have noted. |
Looks like this guy does not find an imbalance in braces or parens and so returns the same indent level. private int simpleComputeNextLineIndentLevel(int indentLevel, List<Token> tokens) {
int adjust = getOpenVersusCloseBalance(tokens);
if (adjust > 0)
indentLevel += getPrefs().getIndentationSize();
else if (adjust < 0)
indentLevel = indentLevel - getPrefs().getIndentationSize();
return indentLevel;
} |
Should be fixed. |
I do not know what I have enabled, but I have definitely tested some nonsensical instructions like if (1==2)\nreturn and stuff in both java and groovy, and in java it indented, in groovy it didn't. |
Sorry, I made a small error that failed the build. This should be available for test in a few minutes. |
okay, I downloaded the latest update and tried to use it. then the if line is of course correctly indented, return is correctly indented (shifted right), but the next line has not been unindented properly. |
Was your original request satisfied? Can you close this issue and open a new one with current and expected code snippets? Use three backticks to start and end a multi-line code block. |
I have noticed that when you write a line such as:
if (a == 1)
and then press enter, the next statement does not get properly indented. When manually formatting the source using the format menu item, it is indented correctly.
The text was updated successfully, but these errors were encountered: