Fixed WEB-21215 Inconsistent indentation when object is first parameter of function...
authorRustam Vishnyakov <rustam.vishnyakov@jetbrains.com>
Thu, 17 Nov 2016 09:23:23 +0000 (12:23 +0300)
committerRustam Vishnyakov <rustam.vishnyakov@jetbrains.com>
Thu, 17 Nov 2016 09:26:04 +0000 (12:26 +0300)
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);