Format spaces around semicolon

Fixes #KT-12689
This commit is contained in:
Kirill Rakhman
2016-06-20 19:48:29 +02:00
committed by Nikolay Krasko
parent db387bd573
commit a520be5509
4 changed files with 15 additions and 0 deletions
@@ -219,6 +219,9 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
afterInside(ANNOTATION_ENTRY, ANNOTATED_EXPRESSION).spaces(1)
before(SEMICOLON).spaces(0)
after(SEMICOLON).spaces(1)
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) }
+3
View File
@@ -0,0 +1,3 @@
fun foo() {
""; ""
}
+3
View File
@@ -0,0 +1,3 @@
fun foo() {
"" ; ""
}
@@ -517,6 +517,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("Semicolon.after.kt")
public void testSemicolon() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/Semicolon.after.kt");
doTest(fileName);
}
@TestMetadata("SingleLineFunctionLiteral.after.kt")
public void testSingleLineFunctionLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SingleLineFunctionLiteral.after.kt");