@@ -657,8 +657,10 @@ class KotlinInputAstVisitor(
657657 (receiverExpression as ? KtQualifiedExpression )?.selectorExpression
658658 ? : receiverExpression
659659 val current = checkNotNull(part.selectorExpression)
660- if (lastIndexToOpen == 0 &&
661- shouldGroupPartWithPrevious(parts, part, index, previous, current)) {
660+ if (
661+ lastIndexToOpen == 0 &&
662+ shouldGroupPartWithPrevious(parts, part, index, previous, current)
663+ ) {
662664 // this and the previous items should be grouped for better style
663665 // we add another group to open in index 0
664666 groupingInfos[0 ].groupOpenCount++
@@ -702,21 +704,27 @@ class KotlinInputAstVisitor(
702704 return true
703705 }
704706 // this and the previous part are a package name, type name, or property
705- if (previous is KtSimpleNameExpression &&
706- current is KtSimpleNameExpression &&
707- part is KtDotQualifiedExpression ) {
707+ if (
708+ previous is KtSimpleNameExpression &&
709+ current is KtSimpleNameExpression &&
710+ part is KtDotQualifiedExpression
711+ ) {
708712 return true
709713 }
710714 // this is `Foo` in `com.facebook.Foo`, so everything before it is a package name
711- if (current.text.first().isUpperCase() &&
712- current is KtSimpleNameExpression &&
713- part is KtDotQualifiedExpression ) {
715+ if (
716+ current.text.first().isUpperCase() &&
717+ current is KtSimpleNameExpression &&
718+ part is KtDotQualifiedExpression
719+ ) {
714720 return true
715721 }
716722 // this is the `foo()` in `com.facebook.Foo.foo()` or in `Foo.foo()`
717- if (current is KtCallExpression &&
718- (previous !is KtCallExpression ) &&
719- previous.text?.firstOrNull()?.isUpperCase() == true ) {
723+ if (
724+ current is KtCallExpression &&
725+ (previous !is KtCallExpression ) &&
726+ previous.text?.firstOrNull()?.isUpperCase() == true
727+ ) {
720728 return true
721729 }
722730 // this is an invocation and the last item, and the previous it not, i.e. `a.b.c()`
@@ -915,9 +923,11 @@ class KotlinInputAstVisitor(
915923 builder.breakOp(Doc .FillMode .UNIFIED , " " , bracePlusBlockIndent)
916924 builder.block(bracePlusBlockIndent) {
917925 builder.blankLineWanted(OpsBuilder .BlankLineWanted .NO )
918- if (expressionStatements.size == 1 &&
919- expressionStatements.first() !is KtReturnExpression &&
920- ! bodyExpression.startsWithComment()) {
926+ if (
927+ expressionStatements.size == 1 &&
928+ expressionStatements.first() !is KtReturnExpression &&
929+ ! bodyExpression.startsWithComment()
930+ ) {
921931 visitStatement(expressionStatements[0 ])
922932 } else {
923933 visitStatements(expressionStatements)
@@ -1247,8 +1257,10 @@ class KotlinInputAstVisitor(
12471257 val operator = expression.operationReference.text
12481258
12491259 visit(baseExpression)
1250- if (baseExpression is KtPostfixExpression &&
1251- baseExpression.operationReference.text.last() == operator .first()) {
1260+ if (
1261+ baseExpression is KtPostfixExpression &&
1262+ baseExpression.operationReference.text.last() == operator .first()
1263+ ) {
12521264 builder.space()
12531265 }
12541266 builder.token(operator )
@@ -1262,8 +1274,10 @@ class KotlinInputAstVisitor(
12621274 val operator = expression.operationReference.text
12631275
12641276 builder.token(operator )
1265- if (baseExpression is KtPrefixExpression &&
1266- operator .last() == baseExpression.operationReference.text.first()) {
1277+ if (
1278+ baseExpression is KtPrefixExpression &&
1279+ operator .last() == baseExpression.operationReference.text.first()
1280+ ) {
12671281 builder.space()
12681282 }
12691283 visit(baseExpression)
@@ -1467,9 +1481,11 @@ class KotlinInputAstVisitor(
14671481
14681482 var carry = expression
14691483 if (carry is KtCallExpression ) {
1470- if (carry.valueArgumentList?.leftParenthesis == null &&
1471- carry.lambdaArguments.isNotEmpty() &&
1472- carry.typeArgumentList?.arguments.isNullOrEmpty()) {
1484+ if (
1485+ carry.valueArgumentList?.leftParenthesis == null &&
1486+ carry.lambdaArguments.isNotEmpty() &&
1487+ carry.typeArgumentList?.arguments.isNullOrEmpty()
1488+ ) {
14731489 carry = carry.lambdaArguments[0 ].getArgumentExpression()
14741490 } else {
14751491 return false
@@ -2362,9 +2378,11 @@ class KotlinInputAstVisitor(
23622378 visit(expression.leftHandSide)
23632379 if (! openGroupBeforeLeft) builder.open(ZERO )
23642380 val parent = expression.parent
2365- if (parent is KtValueArgument ||
2366- parent is KtParenthesizedExpression ||
2367- parent is KtContainerNode ) {
2381+ if (
2382+ parent is KtValueArgument ||
2383+ parent is KtParenthesizedExpression ||
2384+ parent is KtContainerNode
2385+ ) {
23682386 builder.breakOp(Doc .FillMode .UNIFIED , " " , expressionBreakIndent)
23692387 } else {
23702388 builder.space()
@@ -2527,7 +2545,8 @@ class KotlinInputAstVisitor(
25272545 child is PsiComment -> continue
25282546 child is KtScript && importListEmpty -> OpsBuilder .BlankLineWanted .PRESERVE
25292547 else -> OpsBuilder .BlankLineWanted .YES
2530- })
2548+ }
2549+ )
25312550
25322551 visit(child)
25332552 isFirst = false
@@ -2550,8 +2569,9 @@ class KotlinInputAstVisitor(
25502569 builder.blankLineWanted(OpsBuilder .BlankLineWanted .PRESERVE )
25512570 } else if (lastChildIsContextReceiver) {
25522571 builder.blankLineWanted(OpsBuilder .BlankLineWanted .NO )
2553- } else if (child !is PsiComment &&
2554- (childGetsBlankLineBefore || lastChildHadBlankLineBefore)) {
2572+ } else if (
2573+ child !is PsiComment && (childGetsBlankLineBefore || lastChildHadBlankLineBefore)
2574+ ) {
25552575 builder.blankLineWanted(OpsBuilder .BlankLineWanted .YES )
25562576 }
25572577 visit(child)
0 commit comments