Honor "Use continuation indent in argument lists" for indent by Enter

#KT-22121 Fixed
This commit is contained in:
Dmitry Jemerov
2018-01-08 17:23:25 +01:00
parent d79ac58340
commit 8c7f57ca83
4 changed files with 25 additions and 15 deletions
@@ -262,10 +262,13 @@ abstract class KotlinCommonBlock(
ChildAttributes(block.indent, block.alignment)
} else {
val indent =
if (type == KtNodeTypes.VALUE_PARAMETER_LIST && !settings.kotlinCustomSettings.CONTINUATION_INDENT_IN_PARAMETER_LISTS)
if ((type == KtNodeTypes.VALUE_PARAMETER_LIST && !settings.kotlinCustomSettings.CONTINUATION_INDENT_IN_PARAMETER_LISTS) ||
(type == KtNodeTypes.VALUE_ARGUMENT_LIST && !settings.kotlinCustomSettings.CONTINUATION_INDENT_IN_ARGUMENT_LISTS)
) {
Indent.getNormalIndent()
else
} else {
Indent.getContinuationIndent()
}
ChildAttributes(indent, null)
}
}
@@ -0,0 +1,7 @@
fun test(i: Int) {
test(
<caret>
)
}
// SET_FALSE: CONTINUATION_INDENT_IN_ARGUMENT_LISTS
@@ -0,0 +1,5 @@
fun test(i: Int) {
test(<caret>)
}
// SET_FALSE: CONTINUATION_INDENT_IN_ARGUMENT_LISTS
@@ -1,17 +1,6 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.formatter;
@@ -74,6 +63,12 @@ public class TypingIndentationTestBaseGenerated extends AbstractTypingIndentatio
doNewlineTest(fileName);
}
@TestMetadata("ArgumentListNormalIndent.after.kt")
public void testArgumentListNormalIndent() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/ArgumentListNormalIndent.after.kt");
doNewlineTest(fileName);
}
@TestMetadata("AssignmentAfterEq.after.kt")
public void testAssignmentAfterEq() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/AssignmentAfterEq.after.kt");