Skip to content

Commit 655fc45

Browse files
cypressiousgoodwinnk
authored andcommitted
Format spaces around in keyword
Fixes: KT-10680
1 parent 8fe63cd commit 655fc45

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
167167

168168
around(AS_KEYWORD).spaces(1)
169169
around(IS_KEYWORD).spaces(1)
170+
around(IN_KEYWORD).spaces(1)
170171
aroundInside(IDENTIFIER, BINARY_EXPRESSION).spaces(1)
171172

172173
// before LPAR in constructor(): this() {}

idea/testData/formatter/In.after.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fun f() {
2+
if (1 in intArrayOf()) {
3+
4+
}
5+
}

idea/testData/formatter/In.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fun f() {
2+
if (1 in intArrayOf()) {
3+
4+
}
5+
}

idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,12 @@ public void testIfSpacing() throws Exception {
349349
doTest(fileName);
350350
}
351351

352+
@TestMetadata("In.after.kt")
353+
public void testIn() throws Exception {
354+
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/In.after.kt");
355+
doTest(fileName);
356+
}
357+
352358
@TestMetadata("InfixCall.after.kt")
353359
public void testInfixCall() throws Exception {
354360
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/InfixCall.after.kt");

0 commit comments

Comments
 (0)