The following test fails:
@Test
fun foo() {
val code =
"""
|//////////////////////////////////////////
|fun test() {
| scope {
| val foo =
| runCatching { someFunction() }.getOrNull()
| }
|}
|"""
.trimMargin()
val options = FormattingOptions(
preserveLambdaBreaks = true,
blockIndent = 2,
continuationIndent = 2,
maxWidth = code.lineSequence().first().length,
)
val formattedOnce = Formatter.format(
options = options,
code = code,
)
assertThatFormatting(formattedOnce)
.withOptions(options)
.isEqualTo(formattedOnce)
}
The first formatting produces
fun test() {
scope {
val foo = runCatching {
someFunction()
}.getOrNull()
}
}
the second one does
fun test() {
scope {
val foo = runCatching {
someFunction()
}
.getOrNull()
}
}
(btw kind of surprised that the formatting isn't
val foo = runCatching { someFunction() }
.getOrNull()
but I think that's intended? I mean the line break in lambda)
The following test fails:
The first formatting produces
the second one does
(btw kind of surprised that the formatting isn't
but I think that's intended? I mean the line break in lambda)