Fix KT-16725; Remove spaces between array indices
This commit is contained in:
committed by
Dmitry Jemerov
parent
46ce9a6946
commit
4acb95acb5
@@ -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
@@ -8,13 +8,13 @@ fun test() {
|
||||
1, 2
|
||||
]
|
||||
|
||||
a [
|
||||
a[
|
||||
|
||||
1, 2
|
||||
|
||||
]
|
||||
|
||||
a [
|
||||
a[
|
||||
|
||||
|
||||
1, 2
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
val array = emptyArray<Any>()
|
||||
val foo = array[0]
|
||||
@@ -0,0 +1,2 @@
|
||||
val array = emptyArray<Any>()
|
||||
val foo = array [0]
|
||||
+1
-1
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user