Fixed WEB-21215 Inconsistent indentation when object is first parameter of function...
[idea/community.git] / platform / lang-impl / src / com / intellij / psi / impl / source / codeStyle / lineIndent / JavaLikeLangLineIndentProvider.java
index 0daff82bbf0f0ad175660bf46cd24c1f2fbdc544..bc98f039b6893cf030b030d02e03594ccd7ac626 100644 (file)
@@ -93,7 +93,8 @@ public abstract class JavaLikeLangLineIndentProvider implements LineIndentProvid
             return myFactory.createIndentCalculator(NONE, IndentCalculator.LINE_AFTER);
         }
       }
-      else if (getPosition(editor, offset + 1).isAt(BlockClosingBrace)) {
+      else if (getPosition(editor, offset + 1).matchesRule(
+        position -> position.isAt(BlockClosingBrace) && !position.after().afterOptional(Whitespace).isAt(Comma))) {
         return myFactory.createIndentCalculator(
           NONE,
           position -> {
@@ -133,7 +134,7 @@ public abstract class JavaLikeLangLineIndentProvider implements LineIndentProvid
         return myFactory.createIndentCalculator(CONTINUATION, IndentCalculator.LINE_BEFORE);
       }
       else if (getPosition(editor, offset).matchesRule(
-        position -> position.before().isAt(BlockOpeningBrace)
+        position -> position.before().isAt(BlockOpeningBrace) && !position.before().beforeOptional(Whitespace).isAt(LeftParenthesis)
       )) {
         SemanticEditorPosition position = getPosition(editor, offset).before();
         return myFactory.createIndentCalculator(getIndentTypeInBlock(project, language, position), this::getBlockStatementStartOffset);