Force no line break after dot in chained calls

#KT-20362 Fixed
This commit is contained in:
Dmitry Jemerov
2017-12-20 16:34:59 +01:00
parent 06fa61bb6f
commit 5652fa762f
6 changed files with 35 additions and 16 deletions
@@ -291,8 +291,10 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
afterInside(CONSTRUCTOR_KEYWORD, PRIMARY_CONSTRUCTOR).spaces(0) afterInside(CONSTRUCTOR_KEYWORD, PRIMARY_CONSTRUCTOR).spaces(0)
betweenInside(IDENTIFIER, TYPE_PARAMETER_LIST, CLASS).spaces(0) betweenInside(IDENTIFIER, TYPE_PARAMETER_LIST, CLASS).spaces(0)
aroundInside(DOT, DOT_QUALIFIED_EXPRESSION).spaces(0) beforeInside(DOT, DOT_QUALIFIED_EXPRESSION).spaces(0)
aroundInside(SAFE_ACCESS, SAFE_ACCESS_EXPRESSION).spaces(0) afterInside(DOT, DOT_QUALIFIED_EXPRESSION).spacesNoLineBreak(0)
beforeInside(SAFE_ACCESS, SAFE_ACCESS_EXPRESSION).spaces(0)
afterInside(SAFE_ACCESS, SAFE_ACCESS_EXPRESSION).spacesNoLineBreak(0)
between(MODIFIERS_LIST_ENTRIES, MODIFIERS_LIST_ENTRIES).spaces(1) between(MODIFIERS_LIST_ENTRIES, MODIFIERS_LIST_ENTRIES).spaces(1)
+6
View File
@@ -0,0 +1,6 @@
val ret = (DB.Article innerJoin DB.Project).slice(DB.Article.project, DB.Article.project.count()).select {
filterBlogs(params)
}.groupBy(DB.Article.project).map {
val count = it[DB.Article.project.count()]
val project = it[DB.Article.team.count()]
}
+8
View File
@@ -0,0 +1,8 @@
val ret = (DB.Article innerJoin DB.Project).
slice(DB.Article.project, DB.Article.project.count()).
select {
filterBlogs(params)
}.groupBy(DB.Article.project).map {
val count = it[DB.Article.project.count()]
val project = it[DB.Article.team.count()]
}
@@ -5,13 +5,9 @@ interface Test {
fun test(t: Test) { fun test(t: Test) {
t.foo() t.foo()
t. t.foo()
foo()
t. t.foo()
foo()
t t
@@ -24,13 +20,9 @@ fun test(t: Test) {
t?.foo() t?.foo()
t?. t?.foo()
foo()
t?. t?.foo()
foo()
t t
@@ -524,6 +524,18 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName); doTest(fileName);
} }
@TestMetadata("KT15099.after.kt")
public void testKT15099() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/KT15099.after.kt");
doTest(fileName);
}
@TestMetadata("KT20362.after.kt")
public void testKT20362() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/KT20362.after.kt");
doTest(fileName);
}
@TestMetadata("KeepLineBreak.after.kt") @TestMetadata("KeepLineBreak.after.kt")
public void testKeepLineBreak() throws Exception { public void testKeepLineBreak() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/KeepLineBreak.after.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/KeepLineBreak.after.kt");
@@ -2,7 +2,6 @@
class JavaClass { class JavaClass {
var v = "" var v = ""
fun m(s: String) { fun m(s: String) {
s. s.this.v.
this.v.
} }
} }