Support formatting of 'where' clauses

#KT-14083 Fixed
This commit is contained in:
Dmitry Jemerov
2017-07-18 18:49:36 +02:00
parent 325e950bfe
commit 7555bb6c3c
4 changed files with 39 additions and 1 deletions
@@ -263,6 +263,9 @@ abstract class KotlinCommonBlock(
}
}
parentType == KtNodeTypes.TYPE_CONSTRAINT_LIST ->
createAlignmentStrategy(true, getAlignment())
else ->
getNullAlignmentStrategy()
}
@@ -505,7 +508,12 @@ private val INDENT_RULES = arrayOf<NodeIndentStrategy>(
Indent.getContinuationIndent()
else
Indent.getNormalIndent()
})
},
strategy("Where clause")
.within(KtNodeTypes.CLASS, KtNodeTypes.FUN, KtNodeTypes.PROPERTY)
.forType(KtTokens.WHERE_KEYWORD)
.set(Indent.getContinuationIndent()))
private fun getOperationType(node: ASTNode): IElementType? = node.findChildByType(KtNodeTypes.OPERATION_REFERENCE)?.firstChildNode?.elementType