Add formatting rule for array literals
#KT-19599 Fixed
This commit is contained in:
@@ -534,7 +534,13 @@ private val INDENT_RULES = arrayOf<NodeIndentStrategy>(
|
|||||||
strategy("Where clause")
|
strategy("Where clause")
|
||||||
.within(KtNodeTypes.CLASS, KtNodeTypes.FUN, KtNodeTypes.PROPERTY)
|
.within(KtNodeTypes.CLASS, KtNodeTypes.FUN, KtNodeTypes.PROPERTY)
|
||||||
.forType(KtTokens.WHERE_KEYWORD)
|
.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
|
private fun getOperationType(node: ASTNode): IElementType? = node.findChildByType(KtNodeTypes.OPERATION_REFERENCE)?.firstChildNode?.elementType
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
@Component(
|
||||||
|
modules = [
|
||||||
|
AppModule::class,
|
||||||
|
DataModule::class,
|
||||||
|
DomainModule::class
|
||||||
|
]
|
||||||
|
)
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
@Component(
|
||||||
|
modules = [
|
||||||
|
AppModule::class,
|
||||||
|
DataModule::class,
|
||||||
|
DomainModule::class
|
||||||
|
]
|
||||||
|
)
|
||||||
@@ -68,6 +68,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
|
|||||||
doTest(fileName);
|
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")
|
@TestMetadata("BinaryExpressionAlignmentSpread.after.kt")
|
||||||
public void testBinaryExpressionAlignmentSpread() throws Exception {
|
public void testBinaryExpressionAlignmentSpread() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/BinaryExpressionAlignmentSpread.after.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/BinaryExpressionAlignmentSpread.after.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user