Formatter: Add wrapping support for parameter/argument lists

#KT-6032 Fixed
This commit is contained in:
Alexey Sedunov
2014-11-26 17:42:55 +03:00
parent c6541ccc6f
commit 8f2c543f7e
22 changed files with 612 additions and 21 deletions
@@ -0,0 +1,21 @@
// SET_INT: CALL_PARAMETERS_WRAP = 4
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS_IN_CALLS
// RIGHT_MARGIN: 30
fun foo() {
testtest()
testtesttesttesttesttesttesttesttest()
testtest(foofoo)
testtesttesttest(
foofoofoofoofoofoofoofoofoofoofoofoo)
testtest(foobar, barfoo)
testtesttesttest(foofoo,
barbar,
foobar,
barfoo)
}
@@ -0,0 +1,17 @@
// SET_INT: CALL_PARAMETERS_WRAP = 4
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS_IN_CALLS
// RIGHT_MARGIN: 30
fun foo() {
testtest()
testtesttesttesttesttesttesttesttest()
testtest(foofoo)
testtesttesttest(foofoofoofoofoofoofoofoofoofoofoofoo)
testtest(foobar, barfoo)
testtesttesttest(foofoo, barbar, foobar, barfoo)
}
@@ -0,0 +1,17 @@
// SET_INT: CALL_PARAMETERS_WRAP = 0
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS_IN_CALLS
// RIGHT_MARGIN: 30
fun foo() {
testtest()
testtesttesttesttesttesttesttesttest()
testtest(foofoo)
testtesttesttest(foofoofoofoofoofoofoofoofoofoofoofoo)
testtest(foobar, barfoo)
testtesttesttest(foofoo, barbar, foobar, barfoo)
}
@@ -0,0 +1,17 @@
// SET_INT: CALL_PARAMETERS_WRAP = 0
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS_IN_CALLS
// RIGHT_MARGIN: 30
fun foo() {
testtest()
testtesttesttesttesttesttesttesttest()
testtest(foofoo)
testtesttesttest(foofoofoofoofoofoofoofoofoofoofoofoo)
testtest(foobar, barfoo)
testtesttesttest(foofoo, barbar, foobar, barfoo)
}
@@ -0,0 +1,21 @@
// SET_INT: CALL_PARAMETERS_WRAP = 2
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS_IN_CALLS
// RIGHT_MARGIN: 30
fun foo() {
testtest()
testtesttesttesttesttesttesttesttest()
testtest(foofoo)
testtesttesttest(foofoofoofoofoofoofoofoofoofoofoofoo)
testtest(foobar,
barfoo)
testtesttesttest(foofoo,
barbar,
foobar,
barfoo)
}
@@ -0,0 +1,17 @@
// SET_INT: CALL_PARAMETERS_WRAP = 2
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS_IN_CALLS
// RIGHT_MARGIN: 30
fun foo() {
testtest()
testtesttesttesttesttesttesttesttest()
testtest(foofoo)
testtesttesttest(foofoofoofoofoofoofoofoofoofoofoofoo)
testtest(foobar, barfoo)
testtesttesttest(foofoo, barbar, foobar, barfoo)
}
@@ -0,0 +1,21 @@
// SET_INT: CALL_PARAMETERS_WRAP = 1
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS_IN_CALLS
// RIGHT_MARGIN: 30
fun foo() {
testtest()
testtesttesttesttesttesttesttesttest()
testtest(foofoo)
testtesttesttest(
foofoofoofoofoofoofoofoofoofoofoofoo)
testtest(foobar, barfoo)
testtesttesttest(foofoo,
barbar,
foobar,
barfoo)
}
@@ -0,0 +1,17 @@
// SET_INT: CALL_PARAMETERS_WRAP = 1
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS_IN_CALLS
// RIGHT_MARGIN: 30
fun foo() {
testtest()
testtesttesttesttesttesttesttesttest()
testtest(foofoo)
testtesttesttest(foofoofoofoofoofoofoofoofoofoofoofoo)
testtest(foobar, barfoo)
testtesttesttest(foofoo, barbar, foobar, barfoo)
}
@@ -0,0 +1,36 @@
// SET_INT: METHOD_PARAMETERS_WRAP = 4
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS
// RIGHT_MARGIN: 30
fun testtest()
fun testtesttesttesttesttesttesttesttest()
fun testtest(foofoo: Int)
fun testtesttesttest(foofoo: Int)
fun test(foo: Int, bar: Int)
fun testtesttesttest(foofoo: Int,
barbar: Int,
foobar: Int,
barfoo: Int)
fun test() {
for (foo: Int in bar) {
}
for (foofoofoofoofoofoo: Int in bar) {
}
try {
} catch (bar: Exception) {
} catch (barbarbarbarbar: Exception) {
}
}
@@ -0,0 +1,33 @@
// SET_INT: METHOD_PARAMETERS_WRAP = 4
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS
// RIGHT_MARGIN: 30
fun testtest()
fun testtesttesttesttesttesttesttesttest()
fun testtest(foofoo: Int)
fun testtesttesttest(foofoo: Int)
fun test(foo: Int, bar: Int)
fun testtesttesttest(foofoo: Int, barbar: Int, foobar: Int, barfoo: Int)
fun test() {
for (foo: Int in bar) {
}
for (foofoofoofoofoofoo: Int in bar) {
}
try {
} catch (bar: Exception) {
} catch (barbarbarbarbar: Exception) {
}
}
@@ -0,0 +1,33 @@
// SET_INT: METHOD_PARAMETERS_WRAP = 0
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS
// RIGHT_MARGIN: 30
fun testtest()
fun testtesttesttesttesttesttesttesttest()
fun testtest(foofoo: Int)
fun testtesttesttest(foofoo: Int)
fun test(foo: Int, bar: Int)
fun testtesttesttest(foofoo: Int, barbar: Int, foobar: Int, barfoo: Int)
fun test() {
for (foo: Int in bar) {
}
for (foofoofoofoofoofoo: Int in bar) {
}
try {
} catch (bar: Exception) {
} catch (barbarbarbarbar: Exception) {
}
}
@@ -0,0 +1,33 @@
// SET_INT: METHOD_PARAMETERS_WRAP = 0
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS
// RIGHT_MARGIN: 30
fun testtest()
fun testtesttesttesttesttesttesttesttest()
fun testtest(foofoo: Int)
fun testtesttesttest(foofoo: Int)
fun test(foo: Int, bar: Int)
fun testtesttesttest(foofoo: Int, barbar: Int, foobar: Int, barfoo: Int)
fun test() {
for (foo: Int in bar) {
}
for (foofoofoofoofoofoo: Int in bar) {
}
try {
} catch (bar: Exception) {
} catch (barbarbarbarbar: Exception) {
}
}
@@ -0,0 +1,37 @@
// SET_INT: METHOD_PARAMETERS_WRAP = 2
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS
// RIGHT_MARGIN: 30
fun testtest()
fun testtesttesttesttesttesttesttesttest()
fun testtest(foofoo: Int)
fun testtesttesttest(foofoo: Int)
fun test(foo: Int,
bar: Int)
fun testtesttesttest(foofoo: Int,
barbar: Int,
foobar: Int,
barfoo: Int)
fun test() {
for (foo: Int in bar) {
}
for (foofoofoofoofoofoo: Int in bar) {
}
try {
} catch (bar: Exception) {
} catch (barbarbarbarbar: Exception) {
}
}
@@ -0,0 +1,33 @@
// SET_INT: METHOD_PARAMETERS_WRAP = 2
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS
// RIGHT_MARGIN: 30
fun testtest()
fun testtesttesttesttesttesttesttesttest()
fun testtest(foofoo: Int)
fun testtesttesttest(foofoo: Int)
fun test(foo: Int, bar: Int)
fun testtesttesttest(foofoo: Int, barbar: Int, foobar: Int, barfoo: Int)
fun test() {
for (foo: Int in bar) {
}
for (foofoofoofoofoofoo: Int in bar) {
}
try {
} catch (bar: Exception) {
} catch (barbarbarbarbar: Exception) {
}
}
@@ -0,0 +1,38 @@
// SET_INT: METHOD_PARAMETERS_WRAP = 1
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS
// RIGHT_MARGIN: 30
fun testtest()
fun testtesttesttesttesttesttesttesttest()
fun testtest(foofoo: Int)
fun testtesttesttest(
foofoo: Int)
fun test(foo: Int, bar: Int)
fun testtesttesttest(
foofoo: Int,
barbar: Int,
foobar: Int,
barfoo: Int)
fun test() {
for (foo: Int in bar) {
}
for (foofoofoofoofoofoo: Int in bar) {
}
try {
} catch (bar: Exception) {
} catch (barbarbarbarbar: Exception) {
}
}
@@ -0,0 +1,33 @@
// SET_INT: METHOD_PARAMETERS_WRAP = 1
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS
// RIGHT_MARGIN: 30
fun testtest()
fun testtesttesttesttesttesttesttesttest()
fun testtest(foofoo: Int)
fun testtesttesttest(foofoo: Int)
fun test(foo: Int, bar: Int)
fun testtesttesttest(foofoo: Int, barbar: Int, foobar: Int, barfoo: Int)
fun test() {
for (foo: Int in bar) {
}
for (foofoofoofoofoofoo: Int in bar) {
}
try {
} catch (bar: Exception) {
} catch (barbarbarbarbar: Exception) {
}
}