Format spaces around semicolon
Fixes #KT-12689
This commit is contained in:
committed by
Nikolay Krasko
parent
db387bd573
commit
a520be5509
@@ -219,6 +219,9 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
|
|||||||
|
|
||||||
afterInside(ANNOTATION_ENTRY, ANNOTATED_EXPRESSION).spaces(1)
|
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)
|
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) }
|
beforeInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_BEFORE_TYPE_COLON) }
|
||||||
afterInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_AFTER_TYPE_COLON) }
|
afterInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_AFTER_TYPE_COLON) }
|
||||||
|
|||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fun foo() {
|
||||||
|
""; ""
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fun foo() {
|
||||||
|
"" ; ""
|
||||||
|
}
|
||||||
@@ -517,6 +517,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
|
|||||||
doTest(fileName);
|
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")
|
@TestMetadata("SingleLineFunctionLiteral.after.kt")
|
||||||
public void testSingleLineFunctionLiteral() throws Exception {
|
public void testSingleLineFunctionLiteral() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SingleLineFunctionLiteral.after.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/SingleLineFunctionLiteral.after.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user