Bad indentation after annotation in incomplete declaration (KT-22322)

Same behavior is for any modifier in incomplete declaration.

 #KT-22322 Fixed
This commit is contained in:
Nikolay Krasko
2018-09-14 14:52:46 +03:00
parent 94531f992d
commit 782aa94513
7 changed files with 53 additions and 1 deletions
@@ -94,6 +94,16 @@ abstract class KotlinCommonBlock(
fun isLeaf(): Boolean = node.firstChildNode == null
fun isIncomplete(): Boolean {
if (isIncompleteInSuper()) {
return true
}
// An incomplete declaration is the reason when modifier list can become a class body child, otherwise
// it's going to be a declaration child.
return node.elementType == MODIFIER_LIST && node.treeParent?.elementType == CLASS_BODY
}
fun buildChildren(): List<Block> {
if (mySubBlocks != null) {
return mySubBlocks!!
@@ -451,6 +461,11 @@ abstract class KotlinCommonBlock(
return blockList.asSequence()
}
if (this.node.elementType == CLASS_BODY && node.elementType == MODIFIER_LIST) {
// Some unfinished declaration
println()
}
return sequenceOf(buildSubBlock(node, childrenAlignmentStrategy, wrappingStrategy))
}