Format spaces before enum arguments

Fixes #KT-12714
This commit is contained in:
Kirill Rakhman
2016-06-20 19:54:01 +02:00
committed by Nikolay Krasko
parent a520be5509
commit b560aab06d
4 changed files with 18 additions and 0 deletions
@@ -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) }
+5
View File
@@ -0,0 +1,5 @@
enum class Test(val foo: Int) {
One(1),
Two(2),
Three(3)
}
+5
View File
@@ -0,0 +1,5 @@
enum class Test(val foo: Int) {
One(1),
Two (2),
Three (3)
}
@@ -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");