From 6be1da1730e0628cd83eeeff0d062bc078864fb5 Mon Sep 17 00:00:00 2001 From: Konstantin Ulitin Date: Mon, 2 Aug 2021 17:47:54 +0200 Subject: [PATCH] indenter: distinguish control structure from call (WEB-52005) GitOrigin-RevId: 9c65a140259e16b6e98f4a1f50a634b4b1686a97 --- .../lineIndent/JavaLikeLangLineIndentProvider.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/lineIndent/JavaLikeLangLineIndentProvider.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/lineIndent/JavaLikeLangLineIndentProvider.java index 6948b49dd85a..56047f2738a8 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/lineIndent/JavaLikeLangLineIndentProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/lineIndent/JavaLikeLangLineIndentProvider.java @@ -405,13 +405,15 @@ public abstract class JavaLikeLangLineIndentProvider implements LineIndentProvid SemanticEditorPosition candidate = curr.copy(); curr.moveBefore(); curr.moveBeforeOptionalMix(Whitespace, LineComment, BlockComment); - if (!curr.isAt(RightParenthesis)) { - return candidate.getStartOffset(); - } - else { + if (curr.isAt(RightParenthesis)) { curr.moveBeforeParentheses(LeftParenthesis, RightParenthesis); - continue; + SemanticEditorPosition controlStructureCheck = curr.copy(); + controlStructureCheck.moveBeforeOptionalMix(Whitespace, LineComment, BlockComment); + if (isStartOfStatementWithOptionalBlock(controlStructureCheck)) { + continue; + } } + return candidate.getStartOffset(); } else if (curr.isAt(BlockClosingBrace)) { curr.moveBeforeParentheses(BlockOpeningBrace, BlockClosingBrace);