I want to keep a single empty line in the List definition using the scalafmt formatter:
List(
"some-random-string1"
.trim
.stripMargin,
"some-random-string2"
.intern
.dropRight(3),
"some-random-string3"
.takeRight(4)
.substring(10)
)
The formatter removes the empty lines and breaks the readability of such code.
My .scalafmt.conf configuration:
version = "3.7.3"
runner.dialect = scala3
align.preset = most
newlines.source = keep
I want to find a way to configure the formatter to keep the empty lines.
If this is a one-time occurrence in your code, you might want to use // format: off and // format: on around the relevant code to ask scalafmt to preserve its current formatting (documentation):
// format: off
List(
"some-random-string1"
.trim
.stripMargin,
"some-random-string2"
.intern
.dropRight(3),
"some-random-string3"
.takeRight(4)
.substring(10)
)
// format: on
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With