Reputation: 40510
I have this type definition:
type Foo = Bar
with Baz
with Bat
with Bak
with Bar
Which I like formatted the way it is.
But even with newlines.source=keep
scalafmt glues them all into one line (and what's even worse, breaks it into too lines if it ends up being longer than maxColumn
):
type Foo = Bar with Baz with Bat with Bak
with Bar
... which, to me, looks completely unreadable :(
Why is it doing this, and is there a setting that would make it preserve my formatting?
Update In response to comments, here is the entire script:
[sandbox] [1123]> cat .scalafmt.conf
version = "3.7.16"
runner.dialect = scala213
newlines.source=keep
maxColumn = 40
[sandbox] [1124]> scalafmt --version
scalafmt 3.7.16
[sandbox] [1125]> scalafmt --test foobar.scala
--- a/Users/dima/sandbox/foobar.scala
+++ b/Users/dima/sandbox/foobar.scala
@@ -1,9 +1,4 @@
class Foo {
- type It = Foo with
- Bar with
- Baz with
- Bat with
- Bak with
- Bam with
- Ban
+ type It = Foo with Bar with Baz
+ with Bat with Bak with Bam with Ban
}
error: --test failed
Upvotes: 3
Views: 96