Fix lost indent in block statement

IDEA-179073 JavaLikeIndentProvider indent miss
This commit is contained in:
Rustam Vishnyakov
2017-10-13 13:37:39 +03:00
parent b86e135fdd
commit 3ef146e34b
2 changed files with 17 additions and 0 deletions
@@ -234,4 +234,18 @@ public class JavaEnterActionTest extends AbstractEnterActionTestCase {
"\t\t\t<caret>\n" +
") {}");
}
public void testIdea179073() throws IOException {
doTextTest("java",
"ArrayList<String> strings = new ArrayList<>();\n" +
" strings.stream()\n" +
" .forEach((e) -> {<caret>\n" +
" });",
"ArrayList<String> strings = new ArrayList<>();\n" +
" strings.stream()\n" +
" .forEach((e) -> {\n" +
" <caret>\n" +
" });");
}
}
@@ -212,12 +212,15 @@ public abstract class JavaLikeLangLineIndentProvider implements LineIndentProvid
}
else if (position.isAt(RightParenthesis)) {
position.beforeParentheses(LeftParenthesis, RightParenthesis);
continue;
}
else if (position.isAt(BlockClosingBrace)) {
position.beforeParentheses(BlockOpeningBrace, BlockClosingBrace);
continue;
}
else if (position.isAt(ArrayClosingBracket)) {
position.beforeParentheses(ArrayOpeningBracket, ArrayClosingBracket);
continue;
}
else if (position.isAtAnyOf(Semicolon,
BlockOpeningBrace,