formatting `fewerBraces` does not always compile

50 Views Asked by At

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

0

There are 0 best solutions below