Formatter: fix line break before value parameter with annotation

#KT-23811 Fixed
This commit is contained in:
Dmitry Gridin
2019-12-10 16:43:40 +07:00
parent f05a452ef2
commit e7ff0315d4
3 changed files with 51 additions and 8 deletions
@@ -594,12 +594,7 @@ abstract class KotlinCommonBlock(
parentElementType === SECONDARY_CONSTRUCTOR
) {
val wrap = Wrap.createWrap(commonSettings.METHOD_PARAMETERS_WRAP, false)
return { childElement ->
if (childElement.elementType === VALUE_PARAMETER && !childElement.startsWithAnnotation())
wrap
else
null
}
return { childElement -> wrap.takeIf { childElement.elementType === VALUE_PARAMETER } }
}
}
@@ -701,8 +696,6 @@ abstract class KotlinCommonBlock(
}
}
private fun ASTNode.startsWithAnnotation() = firstChildNode?.firstChildNode?.elementType == ANNOTATION_ENTRY
private fun ASTNode.isFirstParameter(): Boolean = treePrev?.elementType == LPAR
private fun wrapAfterAnnotation(wrapType: Int): WrappingStrategy {