-
Notifications
You must be signed in to change notification settings - Fork 284
Closed
Description
This Scala 3 code is formatted as follows:
class Format:
def f =
val received = mutable.Buffer.empty[String]
for (m <- 0 until 10) do
val msg = m.toString
received.addOne(msg)
def g =
val received = mutable.Buffer.empty[String]
for (m <- 0 until 10)
do
val msg = m.toString
received += msg
There is a newline inserted before the second do
but not before the first, and I don't understand why the behavior is not the same for both. (If I manually insert a newline before the first do
, Scalafmt keeps it, but what I really want is to avoid the newline before the second do
.) Unless I'm unaware of some arcane configuration, this seems inconsistent.
I'm running Scalafmt through IntelliJ, and my configuration is below:
version = 3.3.0
runner.dialect = scala3
fileOverride {
"glob:**/*.sbt" {
runner.dialect = sbt1
}
}
preset = defaultWithAlign
maxColumn = 100
indent.main = 3
indentYieldKeyword = false
trailingCommas = preserve
includeNoParensInSelectChains = false
optIn.breaksInsideChains = false
binPack.literalsIncludeSimpleExpr = true
newlines {
alwaysBeforeElseAfterCurlyIf = true
beforeMultiline = keep
beforeCurlyLambdaParams = multilineWithCaseOnly
usingParamListModifierPrefer = before
avoidForSimpleOverflow = [tooLong,punct,slc]
avoidInResultType = true
}
spaces {
beforeContextBoundColon = Always
inImportCurlyBraces = true
afterSymbolicDefs = true
}
literals {
long=Upper
float=Lower
double=Lower
hexPrefix=Lower
scientific=Upper
}
Metadata
Metadata
Assignees
Labels
No labels