Wrap options for constructor parameters

#KT-12176 In Progress
This commit is contained in:
Nikolay Krasko
2016-12-07 16:24:06 +03:00
parent 300601da54
commit 43948a0170
9 changed files with 522 additions and 15 deletions
@@ -297,13 +297,17 @@ abstract class KotlinCommonBlock(
val commonSettings = settings.getCommonSettings(KotlinLanguage.INSTANCE)
val elementType = node.elementType
if (elementType === KtNodeTypes.VALUE_ARGUMENT_LIST) {
return getWrappingStrategyForItemList(commonSettings.CALL_PARAMETERS_WRAP, KtNodeTypes.VALUE_ARGUMENT)
}
if (elementType === KtNodeTypes.VALUE_PARAMETER_LIST) {
val parentElementType = node.treeParent.elementType
if (parentElementType === KtNodeTypes.FUN || parentElementType === KtNodeTypes.CLASS) {
return getWrappingStrategyForItemList(commonSettings.METHOD_PARAMETERS_WRAP, KtNodeTypes.VALUE_PARAMETER)
when {
elementType === KtNodeTypes.VALUE_ARGUMENT_LIST ->
return getWrappingStrategyForItemList(commonSettings.CALL_PARAMETERS_WRAP, KtNodeTypes.VALUE_ARGUMENT)
elementType === KtNodeTypes.VALUE_PARAMETER_LIST -> {
val parentElementType = node.treeParent.elementType
if (parentElementType === KtNodeTypes.FUN ||
parentElementType === KtNodeTypes.PRIMARY_CONSTRUCTOR ||
parentElementType === KtNodeTypes.SECONDARY_CONSTRUCTOR) {
return getWrappingStrategyForItemList(commonSettings.METHOD_PARAMETERS_WRAP, KtNodeTypes.VALUE_PARAMETER)
}
}
}