FIXED IDEA-159285 Editor doesn't auto-indent within switch-case correctly

This commit is contained in:
Rustam Vishnyakov
2016-08-03 18:22:19 +03:00
parent b046b310b0
commit 9503fc37af
@@ -172,6 +172,12 @@ public abstract class JavaLikeLangLineIndentProvider extends FormatterBasedLineI
}
while (!position.isAtEnd()) {
if (currLanguage == Language.ANY || currLanguage == null) currLanguage = position.getLanguage();
if (position.isAt(Colon)) {
SemanticEditorPosition afterColon = getPosition(position.getEditor(), position.getStartOffset()).after().afterOptional(Whitespace);
if (position.isAfterOnSameLine(SwitchCase, SwitchDefault)) {
return afterColon.getStartOffset();
}
}
if (position.isAtAnyOf(Semicolon, BlockOpeningBrace, BlockClosingBrace, BlockComment, DocBlockEnd, LineComment, LeftParenthesis) ||
(position.getLanguage() != Language.ANY) && !position.isAtLanguage(currLanguage)) {
SemanticEditorPosition statementStart = getPosition(position.getEditor(), position.getStartOffset());