KotlinLikeLangLineIndentProvider: fix options for parentheses
Part of #KT-22211 Part of #KT-39353
This commit is contained in:
+7
-1
@@ -274,8 +274,14 @@ abstract class KotlinLikeLangLineIndentProvider : JavaLikeLangLineIndentProvider
|
|||||||
|
|
||||||
private fun isSimilarToFunctionInvocation(leftParenthesis: SemanticEditorPosition): Boolean = with(leftParenthesis.copy()) {
|
private fun isSimilarToFunctionInvocation(leftParenthesis: SemanticEditorPosition): Boolean = with(leftParenthesis.copy()) {
|
||||||
assert(isAt(LeftParenthesis))
|
assert(isAt(LeftParenthesis))
|
||||||
|
|
||||||
moveBeforeIgnoringWhiteSpaceOrComment()
|
moveBeforeIgnoringWhiteSpaceOrComment()
|
||||||
|
|
||||||
|
// `a()()()`
|
||||||
|
// ^
|
||||||
|
while (moveBeforeParenthesesIfPossible()) {
|
||||||
|
// loop
|
||||||
|
}
|
||||||
|
|
||||||
// calls with types e.g. `test<Int>()`
|
// calls with types e.g. `test<Int>()`
|
||||||
moveBeforeTypeParametersIfPossible()
|
moveBeforeTypeParametersIfPossible()
|
||||||
|
|
||||||
|
|||||||
+15
@@ -93,6 +93,21 @@ public class PerformanceTypingIndentationTestGenerated extends AbstractPerforman
|
|||||||
runTest("idea/testData/indentationOnNewline/FunctionBlock2.kt");
|
runTest("idea/testData/indentationOnNewline/FunctionBlock2.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("HigherOrderFunction.kt")
|
||||||
|
public void testHigherOrderFunction() throws Exception {
|
||||||
|
runTest("idea/testData/indentationOnNewline/HigherOrderFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("HigherOrderFunction2.kt")
|
||||||
|
public void testHigherOrderFunction2() throws Exception {
|
||||||
|
runTest("idea/testData/indentationOnNewline/HigherOrderFunction2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("HigherOrderFunction3.kt")
|
||||||
|
public void testHigherOrderFunction3() throws Exception {
|
||||||
|
runTest("idea/testData/indentationOnNewline/HigherOrderFunction3.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InDelegationListAfterColon.kt")
|
@TestMetadata("InDelegationListAfterColon.kt")
|
||||||
public void testInDelegationListAfterColon() throws Exception {
|
public void testInDelegationListAfterColon() throws Exception {
|
||||||
runTest("idea/testData/indentationOnNewline/InDelegationListAfterColon.kt");
|
runTest("idea/testData/indentationOnNewline/InDelegationListAfterColon.kt");
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
fun a(): () -> () -> Unit = { { } }
|
||||||
|
|
||||||
|
fun t() {
|
||||||
|
a()()(
|
||||||
|
<caret>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET_FALSE: ALIGN_MULTILINE_METHOD_BRACKETS
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fun a(): () -> () -> Unit = { { } }
|
||||||
|
|
||||||
|
fun t() {
|
||||||
|
a()()(<caret>)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET_FALSE: ALIGN_MULTILINE_METHOD_BRACKETS
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
fun a(): () -> () -> Unit = { { } }
|
||||||
|
|
||||||
|
fun t() {
|
||||||
|
a()()(
|
||||||
|
<caret>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET_FALSE: ALIGN_MULTILINE_BINARY_OPERATION
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
fun a(): () -> () -> Unit = { { } }
|
||||||
|
|
||||||
|
fun t() {
|
||||||
|
a()()(
|
||||||
|
<caret>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET_FALSE: ALIGN_MULTILINE_BINARY_OPERATION
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fun a(): () -> () -> Unit = { { } }
|
||||||
|
|
||||||
|
fun t() {
|
||||||
|
a()()(<caret>)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET_FALSE: ALIGN_MULTILINE_BINARY_OPERATION
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
fun a(): () -> () -> Unit = { { } }
|
||||||
|
|
||||||
|
fun t() {
|
||||||
|
a()()(
|
||||||
|
<caret>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET_TRUE: ALIGN_MULTILINE_METHOD_BRACKETS
|
||||||
|
// IGNORE_FORMATTER
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fun a(): () -> () -> Unit = { { } }
|
||||||
|
|
||||||
|
fun t() {
|
||||||
|
a()()(<caret>)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET_TRUE: ALIGN_MULTILINE_METHOD_BRACKETS
|
||||||
|
// IGNORE_FORMATTER
|
||||||
+20
@@ -95,6 +95,21 @@ public class TypingIndentationTestBaseGenerated extends AbstractTypingIndentatio
|
|||||||
runTest("idea/testData/indentationOnNewline/FunctionBlock2.after.kt");
|
runTest("idea/testData/indentationOnNewline/FunctionBlock2.after.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("HigherOrderFunction.after.kt")
|
||||||
|
public void testHigherOrderFunction() throws Exception {
|
||||||
|
runTest("idea/testData/indentationOnNewline/HigherOrderFunction.after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("HigherOrderFunction2.after.kt")
|
||||||
|
public void testHigherOrderFunction2() throws Exception {
|
||||||
|
runTest("idea/testData/indentationOnNewline/HigherOrderFunction2.after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("HigherOrderFunction3.after.kt")
|
||||||
|
public void testHigherOrderFunction3() throws Exception {
|
||||||
|
runTest("idea/testData/indentationOnNewline/HigherOrderFunction3.after.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InDelegationListAfterColon.after.kt")
|
@TestMetadata("InDelegationListAfterColon.after.kt")
|
||||||
public void testInDelegationListAfterColon() throws Exception {
|
public void testInDelegationListAfterColon() throws Exception {
|
||||||
runTest("idea/testData/indentationOnNewline/InDelegationListAfterColon.after.kt");
|
runTest("idea/testData/indentationOnNewline/InDelegationListAfterColon.after.kt");
|
||||||
@@ -1157,6 +1172,11 @@ public class TypingIndentationTestBaseGenerated extends AbstractTypingIndentatio
|
|||||||
runTest("idea/testData/indentationOnNewline/ArgumentListNormalIndent.after.inv.kt");
|
runTest("idea/testData/indentationOnNewline/ArgumentListNormalIndent.after.inv.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("HigherOrderFunction2.after.inv.kt")
|
||||||
|
public void testHigherOrderFunction2() throws Exception {
|
||||||
|
runTest("idea/testData/indentationOnNewline/HigherOrderFunction2.after.inv.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InDelegationListAfterColon.after.inv.kt")
|
@TestMetadata("InDelegationListAfterColon.after.inv.kt")
|
||||||
public void testInDelegationListAfterColon() throws Exception {
|
public void testInDelegationListAfterColon() throws Exception {
|
||||||
runTest("idea/testData/indentationOnNewline/InDelegationListAfterColon.after.inv.kt");
|
runTest("idea/testData/indentationOnNewline/InDelegationListAfterColon.after.inv.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user