Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use regular indents for parameter lists #342

Merged
merged 1 commit into from
Mar 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/com/squareup/kotlinpoet/ParameterSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ internal fun List<ParameterSpec>.emit(
}
else -> {
emit("\n")
indent(2)
indent(1)
forEachIndexed { index, parameter ->
if (index > 0) emit(",\n")
emitBlock(parameter)
}
unindent(2)
unindent(1)
emit("\n")
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ class KotlinPoetTest {
|import kotlin.String
|
|class Taco(
| val cheese: String,
| var cilantro: String,
| lettuce: String
| val cheese: String,
| var cilantro: String,
| lettuce: String
|) {
| val lettuce: String = lettuce.trim()
|
Expand Down Expand Up @@ -367,9 +367,9 @@ class KotlinPoetTest {
|import kotlin.Unit
|
|fun ((
| name: String,
| Int,
| age: Long
| name: String,
| Int,
| age: Long
|) -> Unit).whatever(): Unit = Unit
|""".trimMargin())
}
Expand Down
104 changes: 52 additions & 52 deletions src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ class TypeSpecTest {
|
|class Foo {
| constructor(
| id: Long,
| @Ping one: String,
| @Ping two: String,
| @Pong("pong") three: String,
| @Ping four: String
| id: Long,
| @Ping one: String,
| @Ping two: String,
| @Pong("pong") three: String,
| @Ping four: String
| ) {
| /* code snippets */
| }
Expand Down Expand Up @@ -356,9 +356,9 @@ class TypeSpecTest {
| )
| @POST("/foo/bar")
| fun fooBar(
| @Body things: Things<Thing>,
| @QueryMap(encodeValues = false) query: Map<String, String>,
| @Header("Authorization") authorization: String
| @Body things: Things<Thing>,
| @QueryMap(encodeValues = false) query: Map<String, String>,
| @Header("Authorization") authorization: String
| ): Observable<FooBar>
|}
|""".trimMargin())
Expand Down Expand Up @@ -666,9 +666,9 @@ class TypeSpecTest {
| override fun compareTo(p: P): Int = 0
|
| fun <T, P : Number> of(
| label: T,
| x: P,
| y: P
| label: T,
| x: P,
| y: P
| ): Location<T, P> {
| throw new UnsupportedOperationException("TODO")
| }
Expand Down Expand Up @@ -1187,9 +1187,9 @@ class TypeSpecTest {
|
|class Taqueria {
| fun prepare(
| workers: Int,
| vararg jobs: Runnable,
| start: Boolean
| workers: Int,
| vararg jobs: Runnable,
| start: Boolean
| ) {
| }
|}
Expand Down Expand Up @@ -2178,38 +2178,38 @@ class TypeSpecTest {
|
|class Taco {
| fun call(
| s0: String,
| s1: String,
| s2: String,
| s3: String,
| s4: String,
| s5: String,
| s6: String,
| s7: String,
| s8: String,
| s9: String,
| s10: String,
| s11: String,
| s12: String,
| s13: String,
| s14: String,
| s15: String,
| s16: String,
| s17: String,
| s18: String,
| s19: String,
| s20: String,
| s21: String,
| s22: String,
| s23: String,
| s24: String,
| s25: String,
| s26: String,
| s27: String,
| s28: String,
| s29: String,
| s30: String,
| s31: String
| s0: String,
| s1: String,
| s2: String,
| s3: String,
| s4: String,
| s5: String,
| s6: String,
| s7: String,
| s8: String,
| s9: String,
| s10: String,
| s11: String,
| s12: String,
| s13: String,
| s14: String,
| s15: String,
| s16: String,
| s17: String,
| s18: String,
| s19: String,
| s20: String,
| s21: String,
| s22: String,
| s23: String,
| s24: String,
| s25: String,
| s26: String,
| s27: String,
| s28: String,
| s29: String,
| s30: String,
| s31: String
| ) {
| call("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15",
| "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29",
Expand Down Expand Up @@ -2728,9 +2728,9 @@ class TypeSpecTest {
|import kotlin.collections.Map
|
|class Taco(
| val a: String?,
| val b: String?,
| val c: String?
| val a: String?,
| val b: String?,
| val c: String?
|) {
| constructor(map: Map<String, String>) : this(map["a"], map["b"], map["c"])
|}
Expand Down Expand Up @@ -2817,9 +2817,9 @@ class TypeSpecTest {
|import kotlin.String
|
|data class Person(
| override val id: Int,
| override val name: String,
| override val surname: String
| override val id: Int,
| override val name: String,
| override val surname: String
|)
|""".trimMargin())
}
Expand Down