diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt index 9bba23bd1fc..e19d2b349f8 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt @@ -210,8 +210,8 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing beforeInside(RPAR, VALUE_PARAMETER_LIST).spaces(0, kotlinCommonSettings.METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE) afterInside(LT, TYPE_PARAMETER_LIST).spaces(0) beforeInside(GT, TYPE_PARAMETER_LIST).spaces(0) - afterInside(LPAR, VALUE_ARGUMENT_LIST).spaces(0) - beforeInside(RPAR, VALUE_ARGUMENT_LIST).spaces(0) + afterInside(LPAR, VALUE_ARGUMENT_LIST).spaces(0, kotlinCommonSettings.CALL_PARAMETERS_LPAREN_ON_NEXT_LINE) + beforeInside(RPAR, VALUE_ARGUMENT_LIST).spaces(0, kotlinCommonSettings.CALL_PARAMETERS_RPAREN_ON_NEXT_LINE) afterInside(LT, TYPE_ARGUMENT_LIST).spaces(0) beforeInside(GT, TYPE_ARGUMENT_LIST).spaces(0) before(TYPE_ARGUMENT_LIST).spaces(0) diff --git a/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt b/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt index bb5e5607491..af2d6e0b70b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt @@ -216,7 +216,9 @@ class KotlinLanguageCodeStyleSettingsProvider : LanguageCodeStyleSettingsProvide "CALL_PARAMETERS_WRAP", "METHOD_PARAMETERS_WRAP", "METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE", - "METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" + "METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE", + "CALL_PARAMETERS_LPAREN_ON_NEXT_LINE", + "CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" ) consumer.renameStandardOption(CodeStyleSettingsCustomizable.WRAPPING_SWITCH_STATEMENT, "'when' statements") showCustomOption(KotlinCodeStyleSettings::ALIGN_IN_COLUMNS_CASE_BRANCH, diff --git a/idea/testData/formatter/CallLParenthOnNextLine.after.inv.kt b/idea/testData/formatter/CallLParenthOnNextLine.after.inv.kt new file mode 100644 index 00000000000..e3ad0e44cc0 --- /dev/null +++ b/idea/testData/formatter/CallLParenthOnNextLine.after.inv.kt @@ -0,0 +1,4 @@ +val x = foo("a", + "b") + +// SET_TRUE: CALL_PARAMETERS_LPAREN_ON_NEXT_LINE diff --git a/idea/testData/formatter/CallLParenthOnNextLine.after.kt b/idea/testData/formatter/CallLParenthOnNextLine.after.kt new file mode 100644 index 00000000000..c6ae06b5fcd --- /dev/null +++ b/idea/testData/formatter/CallLParenthOnNextLine.after.kt @@ -0,0 +1,5 @@ +val x = foo( + "a", + "b") + +// SET_TRUE: CALL_PARAMETERS_LPAREN_ON_NEXT_LINE diff --git a/idea/testData/formatter/CallLParenthOnNextLine.kt b/idea/testData/formatter/CallLParenthOnNextLine.kt new file mode 100644 index 00000000000..e3ad0e44cc0 --- /dev/null +++ b/idea/testData/formatter/CallLParenthOnNextLine.kt @@ -0,0 +1,4 @@ +val x = foo("a", + "b") + +// SET_TRUE: CALL_PARAMETERS_LPAREN_ON_NEXT_LINE diff --git a/idea/testData/formatter/CallRParenthOnNextLine.after.inv.kt b/idea/testData/formatter/CallRParenthOnNextLine.after.inv.kt new file mode 100644 index 00000000000..4ed30224beb --- /dev/null +++ b/idea/testData/formatter/CallRParenthOnNextLine.after.inv.kt @@ -0,0 +1,4 @@ +val x = foo("a", + "b") + +// SET_TRUE: CALL_PARAMETERS_RPAREN_ON_NEXT_LINE diff --git a/idea/testData/formatter/CallRParenthOnNextLine.after.kt b/idea/testData/formatter/CallRParenthOnNextLine.after.kt new file mode 100644 index 00000000000..c9be2f54526 --- /dev/null +++ b/idea/testData/formatter/CallRParenthOnNextLine.after.kt @@ -0,0 +1,5 @@ +val x = foo("a", + "b" +) + +// SET_TRUE: CALL_PARAMETERS_RPAREN_ON_NEXT_LINE diff --git a/idea/testData/formatter/CallRParenthOnNextLine.kt b/idea/testData/formatter/CallRParenthOnNextLine.kt new file mode 100644 index 00000000000..4ed30224beb --- /dev/null +++ b/idea/testData/formatter/CallRParenthOnNextLine.kt @@ -0,0 +1,4 @@ +val x = foo("a", + "b") + +// SET_TRUE: CALL_PARAMETERS_RPAREN_ON_NEXT_LINE diff --git a/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java b/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java index 1550b3b331a..600510de62e 100644 --- a/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java @@ -104,6 +104,18 @@ public class FormatterTestGenerated extends AbstractFormatterTest { doTest(fileName); } + @TestMetadata("CallLParenthOnNextLine.after.kt") + public void testCallLParenthOnNextLine() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/CallLParenthOnNextLine.after.kt"); + doTest(fileName); + } + + @TestMetadata("CallRParenthOnNextLine.after.kt") + public void testCallRParenthOnNextLine() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/CallRParenthOnNextLine.after.kt"); + doTest(fileName); + } + @TestMetadata("Cast.after.kt") public void testCast() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/Cast.after.kt"); @@ -1022,6 +1034,18 @@ public class FormatterTestGenerated extends AbstractFormatterTest { doTestInverted(fileName); } + @TestMetadata("CallLParenthOnNextLine.after.inv.kt") + public void testCallLParenthOnNextLine() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/CallLParenthOnNextLine.after.inv.kt"); + doTestInverted(fileName); + } + + @TestMetadata("CallRParenthOnNextLine.after.inv.kt") + public void testCallRParenthOnNextLine() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/CallRParenthOnNextLine.after.inv.kt"); + doTestInverted(fileName); + } + @TestMetadata("CatchFinallyOnNewLine.after.inv.kt") public void testCatchFinallyOnNewLine() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/CatchFinallyOnNewLine.after.inv.kt");