No line break before = in property initializer and function expr body

This commit is contained in:
Dmitry Jemerov
2017-12-08 14:51:07 +01:00
parent ab99bf843a
commit d1daca2560
4 changed files with 25 additions and 0 deletions
@@ -197,6 +197,11 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
before(COMMA).spaceIf(kotlinCommonSettings.SPACE_BEFORE_COMMA)
after(COMMA).spaceIf(kotlinCommonSettings.SPACE_AFTER_COMMA)
val spacesAroundAssignment = if (kotlinCommonSettings.SPACE_AROUND_ASSIGNMENT_OPERATORS) 1 else 0
beforeInside(EQ, PROPERTY).spacing(spacesAroundAssignment, spacesAroundAssignment, 0, false, 0)
beforeInside(EQ, FUN).spacing(spacesAroundAssignment, spacesAroundAssignment, 0, false, 0)
around(TokenSet.create(EQ, MULTEQ, DIVEQ, PLUSEQ, MINUSEQ, PERCEQ)).spaceIf(kotlinCommonSettings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
around(TokenSet.create(ANDAND, OROR)).spaceIf(kotlinCommonSettings.SPACE_AROUND_LOGICAL_OPERATORS)
around(TokenSet.create(EQEQ, EXCLEQ, EQEQEQ, EXCLEQEQEQ)).spaceIf(kotlinCommonSettings.SPACE_AROUND_EQUALITY_OPERATORS)
@@ -0,0 +1,6 @@
val x: Int = 1
fun foo() = 1
fun bar() =
1
@@ -0,0 +1,8 @@
val x: Int
= 1
fun foo()
= 1
fun bar() =
1
@@ -662,6 +662,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("PropertyInitializerLineBreak.after.kt")
public void testPropertyInitializerLineBreak() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/PropertyInitializerLineBreak.after.kt");
doTest(fileName);
}
@TestMetadata("PropertyTypeParameterList.after.kt")
public void testPropertyTypeParameterList() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/PropertyTypeParameterList.after.kt");