Format spaces around by keyword (#1016)

This commit is contained in:
Ilya Zorin
2017-01-09 13:19:44 +03:00
committed by Dmitry Jemerov
parent 238eaf0d0e
commit ffe80dd549
4 changed files with 17 additions and 0 deletions

View File

@@ -251,6 +251,9 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
betweenInside(TYPE_ARGUMENT_LIST, LAMBDA_ARGUMENT, CALL_EXPRESSION).spaces(1)
between(WHEN_ENTRY, WHEN_ENTRY).lineBreakInCode()
around(BY_KEYWORD).spaces(1)
betweenInside(IDENTIFIER, PROPERTY_DELEGATE, PROPERTY).spaces(1)
}
custom {

4
idea/testData/formatter/By.after.kt vendored Normal file
View File

@@ -0,0 +1,4 @@
class Bar(val r: Runnable) : Runnable by r
class Foo {
val bar by lazy { "" }
}

4
idea/testData/formatter/By.kt vendored Normal file
View File

@@ -0,0 +1,4 @@
class Bar(val r: Runnable) : Runnable by r
class Foo {
val bar by lazy { "" }
}

View File

@@ -98,6 +98,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("By.after.kt")
public void testBy() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/By.after.kt");
doTest(fileName);
}
@TestMetadata("Cast.after.kt")
public void testCast() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/Cast.after.kt");