olafurpg on v1.0.0-RC1
olafurpg on master
Upgrade to non-broken metaconfi… Merge pull request #946 from ol… (compare)
olafurpg on master
documentation fix: binPackParen… Merge pull request #945 from na… (compare)
Hi, sorry if this has been asked before but it's really hard to search for. Is there a way to configure select chains like this:
1.to(5).map { x =>
val y = x + 1
y * y
}.filter(_ % 2 == 0)
as opposed to:
1.to(5).map { x =>
val y = x + 1
y * y
}
.filter(_ % 2 == 0)
I really dislike the dangling code after a closing curly brace but I couldn't find a way to configure it the way I want
and instead get
xs.map { (x: T) =>
foo(x) // fine
}
I've looked in the docs and issues on GitHub and couldn't find a discussion on this. This is for prepping a codebase to migrate to Scala 3
# changed 1.6 or after
align.openParenCallSite = true
align.openParenDefnSite = true
# avoid wrapping parens on new line
danglingParentheses.defnSite = false
danglingParentheses.callSite = false
11:34 AM Can not resolve scalafmt version 2.7.5:
An error occurred during downloading:
unresolved dependency: org.scalameta#scalafmt-cli_2.12;2.7.5: not found
unresolved dependency: org.scala-lang#scala-reflect;2.12.8: not found
instead of this
def foo =
1
.tap { s =>
s.toString
} tap { s =>
s.toString
}
I want
def foo =
1
.tap { s =>
s.toString
} tap { s =>
s.toString
}
Can someone please explain how newlines.topLevelStatementsMinBreaks
works? I don’t really understand it. I think I get what the docs say but it doesn’t seem to work how I expect so my interpretation must be wrong. I tried:
newlines {
topLevelStatements = [before]
topLevelStatementsMinBreaks = 1
}
And expected a newline before every top level statement but it doesn’t do that. What I actually want is a newline before and after every top level def but I don’t know how to do that.
newlines.topLevelStatements = [before,after]
newlines.topLevelStatementsMinBreaks = 0
def loadRow3(): Unit =
x match {
case (
"xxxxxxxxxxxxxxxxxxxxxx"
| "xxxxxxxxxxxxxxx"
| "xxxxxxxxxxxxxxx"
| "xxxxxxxxxxxxxxx"
| "xxxxxxxxxxxxx"
) =>
y
}
Hi,
By default(I suppose) scalafmt changes this
seqTuple2
.map { case (a1, a2) =>
???
}
to this
seqTuple2
.map {
case (a1, a2) =>
???
}
I've tried to find the way how to turn this feature off couple of times, but with no results.
I've found term case arrows
, but not sure if this is what I'm searching.
Can I disable this rewrite rule?
Hi all,
I'm trying to make scalafmt format consecutive parameter blocks (at defn site) in the same way, i.e. to avoid formatting such as:
class MyClass(aaaaaaa: Aaaaaaaaa,
bbbbbbbbbbbbb: Bbbbbbbbbbbbbbb)
(implicit ccccccc: Ccccccccc,
dddddddddddd: Dddddddddddd) extends Eeeeeeee {}
to
class MyClass(aaaaaaa: Aaaaaaaaa, bbbbbbbbbbbbb: Bbbbbbbbbbbbbbb)(implicit
ccccccc: Ccccccccc,
dddddddddddd: Dddddddddddd)
extends Eeeeeeee {}
here with
align.openParenDefnSite = true
danglingParentheses.defnSite = false
Is this at all possible?
Hi folks 👋
Question: is there a workaround to get scalafmt
not failing when cross-compiling Scala 2.13.x and 3.0.x? Right now, it fails if I set scalafmtOnCompile := true
. I would like to keep running it on Scala 2.12.x and shared code but not for files in the Scala 3.x directory. I tried setting format: off
on my Scala 3 file but that didn't work.
I know that Scala 3 support is in progress so all I want is to skip Scala 3 files for now. Thanks!