-
Notifications
You must be signed in to change notification settings - Fork 284
Closed
Description
Please paste the contents of your .scalafmt.conf
file here:
version = 3.8.0
runner.dialect = scala3
When I run scalafmt via CLI like this: scalafmt File.scala
Steps
Given code like this:
class Sfmt {
val pr: PartialFunction[Int, (String, Int)] = {
case e: Int =>
val a = ""
("first", 2)
}
try {
()
} catch {
case e: Throwable =>
println("")
(1, false)
}
1 match {
case 2 =>
println("")
(1, false)
}
List.empty[Matchable].collect{
case x:Int =>
val a = 1
(a)
}
}
Problem
Scalafmt formats code like this:
class Sfmt {
val pr: PartialFunction[Int, (String, Int)] = { case e: Int =>
val a = "" ("first", 2)
}
try {
()
} catch {
case e: Throwable =>
println("")(1, false)
}
1 match {
case 2 =>
println("")(1, false)
}
List.empty[Matchable].collect { case x: Int =>
val a = 1 (a)
}
}
Expectation
I would like the formatted output to look like this:
class Sfmt {
val pr: PartialFunction[Int, (String, Int)] = { case e: Int =>
val a = ""
("first", 2)
}
try {
()
} catch {
case e: Throwable =>
println("")
(1, false)
}
1 match {
case 2 =>
println("")
(1, false)
}
List.empty[Matchable].collect { case x: Int =>
val a = 1
(a)
}
}
Notes
I gave several examples where the bug occurs.
The pattern is that we have code block with case
starting from new line, followed by any line (or lines), followed by line containing code in parenthesis (for example tuples).
joan38
Metadata
Metadata
Assignees
Labels
No labels