diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt index 14441d6079a..0c2aef1f6b9 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt @@ -222,6 +222,8 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing before(SEMICOLON).spaces(0) after(SEMICOLON).spaces(1) + beforeInside(INITIALIZER_LIST, ENUM_ENTRY).spaces(0) + val TYPE_COLON_ELEMENTS = TokenSet.create(PROPERTY, FUN, VALUE_PARAMETER, DESTRUCTURING_DECLARATION_ENTRY, FUNCTION_LITERAL) beforeInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_BEFORE_TYPE_COLON) } afterInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_AFTER_TYPE_COLON) } diff --git a/idea/testData/formatter/EnumArguments.after.kt b/idea/testData/formatter/EnumArguments.after.kt new file mode 100644 index 00000000000..312446f5341 --- /dev/null +++ b/idea/testData/formatter/EnumArguments.after.kt @@ -0,0 +1,5 @@ +enum class Test(val foo: Int) { + One(1), + Two(2), + Three(3) +} \ No newline at end of file diff --git a/idea/testData/formatter/EnumArguments.kt b/idea/testData/formatter/EnumArguments.kt new file mode 100644 index 00000000000..8d165588f77 --- /dev/null +++ b/idea/testData/formatter/EnumArguments.kt @@ -0,0 +1,5 @@ +enum class Test(val foo: Int) { + One(1), + Two (2), + Three (3) +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java b/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java index 8259ece326b..6cd4317427c 100644 --- a/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java @@ -253,6 +253,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest { doTest(fileName); } + @TestMetadata("EnumArguments.after.kt") + public void testEnumArguments() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/EnumArguments.after.kt"); + doTest(fileName); + } + @TestMetadata("ForLineBreak.after.kt") public void testForLineBreak() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/ForLineBreak.after.kt");