Correctly apply annotation wrap before modifier keyword

#KT-20314 Fixed
This commit is contained in:
Dmitry Jemerov
2017-12-20 17:17:22 +01:00
parent fa19bd6d9b
commit 43ef113b7a
21 changed files with 65 additions and 25 deletions
@@ -792,7 +792,14 @@ private fun getWrappingStrategyForItemList(wrapType: Int, itemTypes: TokenSet, w
val itemWrap = Wrap.createWrap(wrapType, wrapFirstElement)
return object : WrappingStrategy {
override fun getWrap(childElement: ASTNode): Wrap? {
return if (childElement.elementType in itemTypes) itemWrap else null
val thisType = childElement.elementType
val prevType = getPrevWithoutWhitespace(childElement)?.elementType
return if (thisType in itemTypes || prevType in itemTypes &&
thisType != KtTokens.EOL_COMMENT && prevType != KtTokens.EOL_COMMENT
)
itemWrap
else
null
}
}
}