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)
What are the parameters that control the layout of Curried methods, as in
def f(...)(...)
? I'm not happy with the default behavior, which breaks line after the second opening parenthesis.
I see several questions along the same lines, but no answers. Is there any way to configure the behavior of scalafmt on methods/classes with multiple lists of arguments?
Two questions...
1 - Is there a Q&A site for Scalafmt, about "which option does this"? This may be helful to unclutter gitter...
2 - Which option does this: control the minimum numbers of parameters in a method declaration (or class or any definition) before newlines are introduced, provided declaration still fits in column length...
E.g. so that the following
def dwarves(fili: Fili, kili: Kili): Ori =
Is not auto-formatted into the following:
def dwarves(
fili: Fili,
kili: Kili
): Ori =
Hey all,
I've opened a PR to add scalafmt to Scala.js: scala-js/scala-js#4260. However, I think I may have encountered a bug when reformatting the codebase, whereby a file's contents got deleted as a result of the reformat. I have a hunch of what may have happened, but I'm not quite certain about it, so I wanted to ask here if this makes any sense.
I added a top-level script (in this commit https://github.com/scala-js/scala-js/pull/4260/commits/95dbd1fc548d6c8737f71b8e855661fe7d57e4cb) that executes scalafmt for each subproject, on multiple threads. However, when I ran the top-level scalafmtAll
, the contents of a file got deleted, which is unexpected. Now, Scala.js has many subprojects, many of which have overlapping file sets. My thinking is that two separate scalafmt threads may have overwritten each other's results. Is this possible at all? If so, would it be possible to change the implementation so that scalafmt always gets a lock on a file before writing it? Or should I not be using scalafmt as a top-level script like that in the first place?
Hi, how am I able to format code like this:
def func(a: Int)
(implicit b: Int): Int = ???
because the default one is:
def func(a: Int)(implicit
b: Int
): Int = ???
I've tried to use optIn.configStyleArguments = false
but didn't worked for me.
Or, is there any possible way to turn off function definition formatting?
12:02 PM Can not resolve scalafmt version 2.6.2:
An error occurred during downloading:
unresolved dependency: org.scalameta#scalafmt-cli_2.12;2.6.2: not found
unresolved dependency: org.scala-lang#scala-reflect;2.12.8: not found
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
}