-
Notifications
You must be signed in to change notification settings - Fork 284
Closed
Description
This issue occurs when you have a single lambda argument with a single statement multi-line body. Scalafmt will drop the lambda to a newline and indent the block. Please correct me if this is working as intended or if a configuration already exists.
With default configuration,
// Before scalafmt (and expected output)
foos.map(foo =>
foo
.withBar("bar")
.toString)
// After scalafmt
foos.map(
foo =>
foo
.withBar("bar")
.toString)
Meanwhile these similar scenarios are unchanged as expected:
foos.map(foo => {
// ...
})
foos.map { foo =>
// ...
}
P.S. for our style guide, I would actually prefer a rewrite rule to add curly braces around multiline lambda bodies:
// Before
foos.map(foo =>
foo
.withBar("bar")
.toString)
// After hypothetical rewrite rule
foos.map(foo => {
foo
.withBar("bar")
.toString
})
Do you think this is doable/worthwhile? I'm always happy to contribute if you think it is a good addition.
jvandew, xljiang, mrowl, cobrien704, Eric-Arellano and 2 more
Metadata
Metadata
Assignees
Labels
No labels