Indent () in if, when, while and do-while with continuation indent (KT-5897)

#KT-5897 Fixed
This commit is contained in:
Nikolay Krasko
2016-12-06 20:10:47 +03:00
parent 211cae2ad2
commit 300601da54
5 changed files with 34 additions and 0 deletions
@@ -368,6 +368,11 @@ private val INDENT_RULES = arrayOf<NodeIndentStrategy>(
.`in`(KtNodeTypes.PARENTHESIZED)
.set(Indent.getContinuationWithoutFirstIndent(false)),
strategy("Round Brackets around conditions")
.forType(LPAR, RPAR)
.`in`(KtNodeTypes.IF, KtNodeTypes.WHEN_ENTRY, KtNodeTypes.WHILE, KtNodeTypes.DO_WHILE)
.set(Indent.getContinuationWithoutFirstIndent(true)),
strategy("KDoc comment indent")
.`in`(KDOC_CONTENT)
.forType(KDocTokens.LEADING_ASTERISK, KDocTokens.END)
@@ -0,0 +1,6 @@
fun test() {
if (true &&
<caret>)
}
// SET_TRUE: ALIGN_MULTILINE_BINARY_OPERATION
@@ -0,0 +1,6 @@
fun test() {
if (true &&
<caret>)
}
// SET_TRUE: ALIGN_MULTILINE_BINARY_OPERATION
@@ -0,0 +1,5 @@
fun test() {
if (true &&<caret>)
}
// SET_TRUE: ALIGN_MULTILINE_BINARY_OPERATION
@@ -146,6 +146,12 @@ public class TypingIndentationTestBaseGenerated extends AbstractTypingIndentatio
doNewlineTest(fileName);
}
@TestMetadata("InBinaryExpressionUnfinishedInIf.after.kt")
public void testInBinaryExpressionUnfinishedInIf() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InBinaryExpressionUnfinishedInIf.after.kt");
doNewlineTest(fileName);
}
@TestMetadata("InBinaryExpressionsBeforeCloseParenthesis.after.kt")
public void testInBinaryExpressionsBeforeCloseParenthesis() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InBinaryExpressionsBeforeCloseParenthesis.after.kt");
@@ -374,6 +380,12 @@ public class TypingIndentationTestBaseGenerated extends AbstractTypingIndentatio
doNewlineTestWithInvert(fileName);
}
@TestMetadata("InBinaryExpressionUnfinishedInIf.after.inv.kt")
public void testInBinaryExpressionUnfinishedInIf() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InBinaryExpressionUnfinishedInIf.after.inv.kt");
doNewlineTestWithInvert(fileName);
}
@TestMetadata("InBinaryExpressionsBeforeCloseParenthesis.after.inv.kt")
public void testInBinaryExpressionsBeforeCloseParenthesis() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InBinaryExpressionsBeforeCloseParenthesis.after.inv.kt");