Don't apply indent on Enter after modifier list

#KT-9562 Fixed
This commit is contained in:
Dmitry Jemerov
2017-12-20 17:31:58 +01:00
parent 43ef113b7a
commit d69382f129
4 changed files with 16 additions and 0 deletions
@@ -237,6 +237,13 @@ abstract class KotlinCommonBlock(
}
}
if (newChildIndex > 0) {
val prevBlock = mySubBlocks?.get(newChildIndex - 1)
if (prevBlock?.node?.elementType == KtNodeTypes.MODIFIER_LIST) {
return ChildAttributes(Indent.getNoneIndent(), null)
}
}
return when (type) {
in CODE_BLOCKS, KtNodeTypes.WHEN, KtNodeTypes.IF, KtNodeTypes.FOR, KtNodeTypes.WHILE, KtNodeTypes.DO_WHILE -> ChildAttributes(Indent.getNormalIndent(), null)
@@ -0,0 +1,2 @@
@Aaaa
<caret>
+1
View File
@@ -0,0 +1 @@
@Aaaa<caret>
@@ -68,6 +68,12 @@ public class TypingIndentationTestBaseGenerated extends AbstractTypingIndentatio
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/indentationOnNewline"), Pattern.compile("^([^\\.]+)\\.after\\.kt.*$"), TargetBackend.ANY, true);
}
@TestMetadata("Annotation.after.kt")
public void testAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/Annotation.after.kt");
doNewlineTest(fileName);
}
@TestMetadata("AssignmentAfterEq.after.kt")
public void testAssignmentAfterEq() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/AssignmentAfterEq.after.kt");