You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run scalafmt via CLI like this: scalafmt --stdin
Steps
Given code like this:
defsum(xs: List[Int]):Int=
xs.foldLeft(0):case (a, b) => a + b
Problem
Scalafmt formats code like this:
defsum(xs: List[Int]):Int=
xs.foldLeft(0):case (a, b) => a + b
Expectation
I would like the formatted output to look like this:
defsum(xs: List[Int]):Int=
xs.foldLeft(0):case (a, b) => a + b
Workaround
Use braces instead of indentation for the last parameter to foldLeft:
defsum(xs: List[Int]):Int=
xs.foldLeft(0) {
case (a, b) => a + b
}
Notes
Only fails on Scala 3.3 onwards (I used 3.3.0-RC1-bin-20230118-9337bd6-NIGHTLY) since the original syntax is only valid with the Fewer Braces-feature (which has been merged into Scala 3.3)
The text was updated successfully, but these errors were encountered:
Configuration
Command-line parameters (required)
When I run scalafmt via CLI like this:
scalafmt --stdin
Steps
Given code like this:
Problem
Scalafmt formats code like this:
Expectation
I would like the formatted output to look like this:
Workaround
Use braces instead of indentation for the last parameter to
foldLeft
:Notes
Only fails on Scala 3.3 onwards (I used 3.3.0-RC1-bin-20230118-9337bd6-NIGHTLY) since the original syntax is only valid with the Fewer Braces-feature (which has been merged into Scala 3.3)
The text was updated successfully, but these errors were encountered: