Is there any way to allow: ```val fruit = listOf( ...
# ktlint
r
Is there any way to allow:
Copy code
val fruit = listOf(
  "apples",
  "pears",
  "oranges",
}
without adding
Copy code
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_string-template-indent = disabled
I much prefer it to:
Copy code
val fruit =
  listOf(
    "apples",
    "pears",
    "oranges",
  }
p
With the default code style (since 1.0.0 this is
ktlint_official
) there is no other way to achieve this. This code style has a stronger emphasis on code consistency. You can fall back on the other code styles in which the multiline-expression rule is not enabled by default. But this will have other side effects as well.
👍 1
c
it would be great if there could be an exception for lambdas.
Copy code
val context = describe(Suite::class) {
......// really long labmda
            }
otherwise I lose a whole indentation level.
p
No sorry. As said
ktlint_official
focuses on consistency, so no exception. Another reason is that everyone want different exceptions for their use case which they think is special. In the end, everything will be allowed again. The idea of wrapping the multiline expression is just that it happens everywhere. It might take some time to get used to it, but in the end the consistency pays off.
👍 1