"Use continuation indent for expression body" for prop initializers

This commit is contained in:
Dmitry Jemerov
2017-12-08 16:17:05 +01:00
parent eacd010e7e
commit 87d2d16cda
3 changed files with 24 additions and 2 deletions
@@ -529,6 +529,18 @@ private val INDENT_RULES = arrayOf<NodeIndentStrategy>(
}
.set(Indent.getNormalIndent()),
strategy("Property initializer")
.within(KtNodeTypes.PROPERTY)
.forElement {
it.psi is KtExpression
}
.set { settings ->
if (settings.kotlinCustomSettings.CONTINUATION_INDENT_FOR_EXPRESSION_BODIES)
Indent.getContinuationWithoutFirstIndent()
else
Indent.getNormalIndent()
},
strategy("Indent for parts")
.within(KtNodeTypes.PROPERTY, KtNodeTypes.FUN, KtNodeTypes.DESTRUCTURING_DECLARATION, KtNodeTypes.SECONDARY_CONSTRUCTOR)
.notForType(KtNodeTypes.BLOCK, FUN_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, CONSTRUCTOR_KEYWORD, KtTokens.RPAR)
@@ -1,6 +1,11 @@
val x: Int = 1
val y: Int =
2
fun foo() = 1
fun bar() =
1
// SET_FALSE: CONTINUATION_INDENT_FOR_EXPRESSION_BODIES
+7 -2
View File
@@ -1,8 +1,13 @@
val x: Int
= 1
= 1
val y: Int =
2
fun foo()
= 1
= 1
fun bar() =
1
// SET_FALSE: CONTINUATION_INDENT_FOR_EXPRESSION_BODIES