Add formatting rule for array literals

#KT-19599 Fixed
This commit is contained in:
Dmitry Jemerov
2017-10-25 14:17:47 +02:00
parent 6420f50f2e
commit a1949e1d53
4 changed files with 27 additions and 1 deletions
@@ -534,7 +534,13 @@ private val INDENT_RULES = arrayOf<NodeIndentStrategy>(
strategy("Where clause")
.within(KtNodeTypes.CLASS, KtNodeTypes.FUN, KtNodeTypes.PROPERTY)
.forType(KtTokens.WHERE_KEYWORD)
.set(Indent.getContinuationIndent()))
.set(Indent.getContinuationIndent()),
strategy("Array literals")
.within(KtNodeTypes.COLLECTION_LITERAL_EXPRESSION)
.notForType(LBRACKET, RBRACKET)
.set(Indent.getNormalIndent())
)
private fun getOperationType(node: ASTNode): IElementType? = node.findChildByType(KtNodeTypes.OPERATION_REFERENCE)?.firstChildNode?.elementType
+7
View File
@@ -0,0 +1,7 @@
@Component(
modules = [
AppModule::class,
DataModule::class,
DomainModule::class
]
)
+7
View File
@@ -0,0 +1,7 @@
@Component(
modules = [
AppModule::class,
DataModule::class,
DomainModule::class
]
)
@@ -68,6 +68,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("ArrayLiteral.after.kt")
public void testArrayLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/ArrayLiteral.after.kt");
doTest(fileName);
}
@TestMetadata("BinaryExpressionAlignmentSpread.after.kt")
public void testBinaryExpressionAlignmentSpread() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/BinaryExpressionAlignmentSpread.after.kt");