Fix 'Formatting after braceless class declaration' (KT-3858)
It's irrelevant that element is incompleted when new node is being add to the middle #KT-3858
This commit is contained in:
@@ -168,8 +168,12 @@ public class JetBlock extends AbstractBlock {
|
||||
return super.getChildAttributes(newChildIndex);
|
||||
}
|
||||
|
||||
if (isIncomplete()) {
|
||||
return super.getChildAttributes(newChildIndex);
|
||||
List<Block> blocks = getSubBlocks();
|
||||
if (newChildIndex != 0) {
|
||||
boolean isIncomplete = newChildIndex < blocks.size() ? blocks.get(newChildIndex - 1).isIncomplete() : isIncomplete();
|
||||
if (isIncomplete) {
|
||||
return super.getChildAttributes(newChildIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return new ChildAttributes(Indent.getNoneIndent(), null);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class A()
|
||||
<caret>
|
||||
|
||||
fun
|
||||
@@ -0,0 +1,3 @@
|
||||
class A()<caret>
|
||||
|
||||
fun
|
||||
@@ -40,6 +40,11 @@ public class JetTypingIndentationTestBaseGenerated extends AbstractJetTypingInde
|
||||
doNewlineTest("idea/testData/indentationOnNewline/AfterCatch.after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AfterClassNameBeforeFun.after.kt")
|
||||
public void testAfterClassNameBeforeFun() throws Exception {
|
||||
doNewlineTest("idea/testData/indentationOnNewline/AfterClassNameBeforeFun.after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AfterFinally.after.kt")
|
||||
public void testAfterFinally() throws Exception {
|
||||
doNewlineTest("idea/testData/indentationOnNewline/AfterFinally.after.kt");
|
||||
|
||||
Reference in New Issue
Block a user