ktlint
ktlint copied to clipboard
Multiline lambda in function call or condition formated different than IntelliJ formatter
Expected Behavior
IntelliJ with official Kotlin code style formats the following code like this:
val list = listOf<Boolean>()
fun test() {
if (list.all {
it == true
}
) {
}
}
Observed Behavior
ktlint complains about wrong indentation:
test.kt:4:1 Unexpected indentation (12) (should be 8) (indent)
test.kt:5:1 Unexpected indentation (8) (should be 4) (indent)
ktlintFormat changes the code to:
val list = listOf<Boolean>()
fun test() {
if (list.all {
it == true
}
) {
}
}
Your Environment
- Version of ktlint used: 0.41.0
- Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): KtLint Gradle 10.0.0
- Version of Gradle used (if applicable): 7.1.1
- Operating System and version: OS: Garuda Linux - 5.10.55-1-lts
@miikeat would you be able to try with the latest snapshot and see if you're still getting this issue?
This problem still occurs with latest snapshot.
Solved by #1682
Closed by #1682