Indent () in if, when, while and do-while with continuation indent (KT-5897)
#KT-5897 Fixed
This commit is contained in:
@@ -368,6 +368,11 @@ private val INDENT_RULES = arrayOf<NodeIndentStrategy>(
|
|||||||
.`in`(KtNodeTypes.PARENTHESIZED)
|
.`in`(KtNodeTypes.PARENTHESIZED)
|
||||||
.set(Indent.getContinuationWithoutFirstIndent(false)),
|
.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")
|
strategy("KDoc comment indent")
|
||||||
.`in`(KDOC_CONTENT)
|
.`in`(KDOC_CONTENT)
|
||||||
.forType(KDocTokens.LEADING_ASTERISK, KDocTokens.END)
|
.forType(KDocTokens.LEADING_ASTERISK, KDocTokens.END)
|
||||||
|
|||||||
+6
@@ -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);
|
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")
|
@TestMetadata("InBinaryExpressionsBeforeCloseParenthesis.after.kt")
|
||||||
public void testInBinaryExpressionsBeforeCloseParenthesis() throws Exception {
|
public void testInBinaryExpressionsBeforeCloseParenthesis() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InBinaryExpressionsBeforeCloseParenthesis.after.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InBinaryExpressionsBeforeCloseParenthesis.after.kt");
|
||||||
@@ -374,6 +380,12 @@ public class TypingIndentationTestBaseGenerated extends AbstractTypingIndentatio
|
|||||||
doNewlineTestWithInvert(fileName);
|
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")
|
@TestMetadata("InBinaryExpressionsBeforeCloseParenthesis.after.inv.kt")
|
||||||
public void testInBinaryExpressionsBeforeCloseParenthesis() throws Exception {
|
public void testInBinaryExpressionsBeforeCloseParenthesis() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InBinaryExpressionsBeforeCloseParenthesis.after.inv.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InBinaryExpressionsBeforeCloseParenthesis.after.inv.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user