Options for wrapping parentheseses in calls (KT-18113)

This commit is contained in:
Dmitry Jemerov
2017-06-12 18:01:57 +02:00
parent 72e8cd7e78
commit 4fa75256b7
9 changed files with 55 additions and 3 deletions
@@ -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)
@@ -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,
@@ -0,0 +1,4 @@
val x = foo("a",
"b")
// SET_TRUE: CALL_PARAMETERS_LPAREN_ON_NEXT_LINE
@@ -0,0 +1,5 @@
val x = foo(
"a",
"b")
// SET_TRUE: CALL_PARAMETERS_LPAREN_ON_NEXT_LINE
+4
View File
@@ -0,0 +1,4 @@
val x = foo("a",
"b")
// SET_TRUE: CALL_PARAMETERS_LPAREN_ON_NEXT_LINE
@@ -0,0 +1,4 @@
val x = foo("a",
"b")
// SET_TRUE: CALL_PARAMETERS_RPAREN_ON_NEXT_LINE
@@ -0,0 +1,5 @@
val x = foo("a",
"b"
)
// SET_TRUE: CALL_PARAMETERS_RPAREN_ON_NEXT_LINE
+4
View File
@@ -0,0 +1,4 @@
val x = foo("a",
"b")
// SET_TRUE: CALL_PARAMETERS_RPAREN_ON_NEXT_LINE
@@ -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");