Fix KT-16725; Remove spaces between array indices

This commit is contained in:
Andrius Semionovas
2017-05-31 16:15:15 +03:00
committed by Dmitry Jemerov
parent 46ce9a6946
commit 4acb95acb5
6 changed files with 15 additions and 3 deletions
@@ -257,6 +257,8 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
around(BY_KEYWORD).spaces(1)
betweenInside(IDENTIFIER, PROPERTY_DELEGATE, PROPERTY).spaces(1)
before(INDICES).spaces(0)
}
custom {
+2 -2
View File
@@ -8,13 +8,13 @@ fun test() {
1, 2
]
a [
a[
1, 2
]
a [
a[
1, 2
+2
View File
@@ -0,0 +1,2 @@
val array = emptyArray<Any>()
val foo = array[0]
+2
View File
@@ -0,0 +1,2 @@
val array = emptyArray<Any>()
val foo = array [0]
@@ -6,5 +6,5 @@ annotation class Ann
fun foo(y: IntArray) {
// Currently it calls reformatting of base expression, but it seems to be a minor issue
@Ann
y [0 + 9 * 4] = y[y [1]]
y[0 + 9 * 4] = y[y [1]]
}
@@ -596,6 +596,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("SpaceBeforeIndices.after.kt")
public void testSpaceBeforeIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SpaceBeforeIndices.after.kt");
doTest(fileName);
}
@TestMetadata("SpacedInsideParans.after.kt")
public void testSpacedInsideParans() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SpacedInsideParans.after.kt");