Don't apply indent on Enter after modifier list
#KT-9562 Fixed
This commit is contained in:
@@ -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>
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user