Vampire
11/23/2023, 9:57 PMif
condition and that is a special case that is also treated differently in the IDE.
ktlint
seems to use 4 spaces in that case.
But IntelliJ by default uses 8 spaces as continuation indent.
On the other hand, using "Set from ... -> Kotlin style guide" does not change the continuation indent value at all.CLOVIS
11/24/2023, 8:50 AMVampire
11/24/2023, 11:51 AMCLOVIS
11/24/2023, 12:26 PMval foo =
if (...) ...
else ...
Vampire
11/24/2023, 12:37 PMval foo = !true &&
!true
vs.
val foo = !true &&
!true
or
.filter { line ->
(line == "a") ||
(line == "b")
}
vs.
.filter { line ->
(line == "a") ||
(line == "b")
}
And my main question is not how the convention is, but where it is documented. I do not find this case documented on the conventions page.CLOVIS
11/24/2023, 1:08 PMclass Person(
id: Int, // HERE
name: String,
surname: String
) : Human(id, name),
KotlinMaker { /*...*/ } // HERE
fun longMethodName(
argument: ArgumentType = defaultValue, // HERE
argument2: AnotherArgumentType,
): ReturnType {
// body
}
fun f(x: String, y: String, z: String) =
veryLongFunctionCallWithManyWords(andLongParametersToo(), x, y, z) // HERE
if (!component.isSyncing &&
!hasAnyKotlinRuntimeInScope(module) // HERE
) {
return createKotlinNotConfiguredPanel(module)
}
private fun parsePropertyValue(propName: String, token: Token) {
when (token) {
is Token.ValueToken ->
callback.visitValue(propName, token.value) // HERE
Token.LBRACE -> { // ...
}
}
}
etcVampire
11/24/2023, 2:48 PMif
condition, but that one has special handling and is also not influenced by the "continuation indent" setting.CLOVIS
11/24/2023, 2:57 PMVampire
11/24/2023, 3:00 PM