Skip to content

Commit ee1e2dd

Browse files
committed
Support formatting for block-like brackets and their chained selectors
1 parent 147d9fc commit ee1e2dd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,14 +1705,14 @@ class KotlinInputAstVisitor(
17051705
*/
17061706
@OptIn(ExperimentalContracts::class)
17071707
private fun isBlockLikeCall(expression: KtExpression?): Boolean {
1708-
contract { returns(true) implies (expression is KtCallExpression) }
1709-
17101708
if (expression == null) return false
17111709
val prev = expression.getPrevSiblingIgnoringWhitespace()
17121710
if (prev is PsiComment) {
17131711
return false // Leading comments cause weird indentation; keep the default layout.
17141712
}
17151713

1714+
if (expression is KtCollectionLiteralExpression) return expression.parent !is KtValueArgument
1715+
17161716
if (expression !is KtCallExpression) return false
17171717
val valueArgumentList = expression.valueArgumentList ?: return false
17181718
if (valueArgumentList.trailingComma != null) return true

0 commit comments

Comments
 (0)