Since Scala 3.3 fewerBraces
is a standard feature. However, when IDEA 2023.2 (Community Edition) with Scala Plugin 2023.2.19 formats the following code, the result does not compile.
class Foo(i: Int)(s: String)
val fooList: List[Foo] = Foo(42):
"""hi"""
:: Nil
After formatting:
class Foo(i: Int)(s: String)
val fooList: List[Foo] = Foo(42):
"""hi"""
:: Nil
Am I doing something wrong or is this a bug? How to solve this?
Edit 1: I found the following workaround.
class Foo(i: Int)(s: String)
// @formatter:off
val fooList: List[Foo] = Foo(42):
"""hi"""
:: Nil
// @formatter:on
Edit 2: I reported a bug
This was fixed in plugin build 2024.1.1 (which works with IDEA 2024.1.1).
https://youtrack.jetbrains.com/issue/SCL-21539/bad-indentation-with-fewer-braces-and-a-list-or-seq