Add indent before accessor for extension property (KT-33131)

#KT-33131 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-10-31 11:51:14 +09:00
committed by Vladimir Dolzhenko
parent c6a481190a
commit ab34f8c738
7 changed files with 45 additions and 2 deletions
@@ -328,10 +328,15 @@ abstract class KotlinCommonBlock(
}
if (newChildIndex > 0) {
val prevBlock = mySubBlocks?.get(newChildIndex - 1)
if (prevBlock?.node?.elementType == MODIFIER_LIST) {
val prevNode = mySubBlocks?.get(newChildIndex - 1)?.node
if (prevNode?.elementType == MODIFIER_LIST) {
return ChildAttributes(Indent.getNoneIndent(), null)
}
val property = prevNode?.psi as? KtProperty
if (property?.receiverTypeReference != null && property.accessors.isNotEmpty()) {
val indent = if (type in CODE_BLOCKS) Indent.getContinuationIndent() else Indent.getNormalIndent()
return ChildAttributes(indent, null)
}
}
return when (type) {