Put arguments/parameters on separate/one line should update trailing comma

#KT-36411 Fixed
This commit is contained in:
Dmitry Gridin
2020-03-03 14:47:21 +07:00
parent 173f90c89c
commit b4898e4043
11 changed files with 102 additions and 9 deletions
@@ -0,0 +1,8 @@
// SET_TRUE: ALLOW_TRAILING_COMMA
// REGISTRY: kotlin.formatter.allowTrailingCommaOnCallSite true
fun f() {
foo(<caret>1, "a", 2)
}
fun foo(p1: Int, p2: String, p3: Int){}
@@ -0,0 +1,12 @@
// SET_TRUE: ALLOW_TRAILING_COMMA
// REGISTRY: kotlin.formatter.allowTrailingCommaOnCallSite true
fun f() {
foo(
1,
"a",
2,
)
}
fun foo(p1: Int, p2: String, p3: Int){}
@@ -0,0 +1,5 @@
// SET_TRUE: ALLOW_TRAILING_COMMA
fun foo(p: Int, c: Char,
b: <caret>Boolean) {
}
@@ -0,0 +1,8 @@
// SET_TRUE: ALLOW_TRAILING_COMMA
fun foo(
p: Int,
c: Char,
b: <caret>Boolean,
) {
}
@@ -0,0 +1,12 @@
// INTENTION_TEXT: "Put arguments on one line"
// REGISTRY: kotlin.formatter.allowTrailingCommaOnCallSite true
fun foo(a: Int = 1, b: Int = 1, c: Int = 1) {}
fun bar(a: Int, b: Int, c: Int) {
foo(
a,
b,<caret>
c,
)
}
@@ -0,0 +1,8 @@
// INTENTION_TEXT: "Put arguments on one line"
// REGISTRY: kotlin.formatter.allowTrailingCommaOnCallSite true
fun foo(a: Int = 1, b: Int = 1, c: Int = 1) {}
fun bar(a: Int, b: Int, c: Int) {
foo(a, b, c)
}
@@ -0,0 +1,8 @@
// INTENTION_TEXT: "Put parameters on one line"
// SET_TRUE: ALLOW_TRAILING_COMMA
fun test(
a: Int,
b: Int,<caret>
c: Int,
) {}
@@ -0,0 +1,4 @@
// INTENTION_TEXT: "Put parameters on one line"
// SET_TRUE: ALLOW_TRAILING_COMMA
fun test(a: Int, b: Int, c: Int) {}