scalafmt - format long chains of infix operators

81 Views Asked by At

I have a type declaration somewhat similar to this one:

type AwesomeType[F[_], X, Y] =
  Foo[F]    ?=>
  Bar[F, X] ?=>
  Baz[F, X] ?=>
  Waffle[X] ?=>
  F[Y]

when I run scalafmt with align.preset = more, it attempts to squeeze this chain of operators into a single line, and emits something like

type AwesomeType[F[_], X, Y] = Foo[F] ?=> Bar[F, X] ?=> Baz[
  F,
  X
] ?=> Waffle[X] ?=> F[Y]

Could anyone suggest a configuration that can cope with long chains of ?=> infix operators?

In case that's relevant:

  • in .scalafmt.conf:
    • version = 3.6.1
    • runner.dialect = scala3
  • in build/plugins.sbt:
    • addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
0

There are 0 best solutions below