Skip to content

Commit

Permalink
Router: refactor post-comma rule
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Jan 15, 2022
1 parent 8d14de9 commit b762f37
Showing 1 changed file with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1485,22 +1485,23 @@ class Router(formatOps: FormatOps) {
}
}
splitsOpt.getOrElse {
if (!style.newlines.formatInfix && leftOwner.is[Term.ApplyInfix])
Seq(
// Do whatever the user did if infix.
Split(Space.orNL(newlines == 0), 0)
)
else {
val indent = leftOwner match {
case _: Defn.Val | _: Defn.Var =>
style.indent.getDefnSite(leftOwner)
case _ =>
0
}
Seq(
Split(Space, 0),
Split(Newline, 1).withIndent(indent, right, After)
)
leftOwner match {
case _: Term.ApplyInfix if !style.newlines.formatInfix =>
Seq(
// Do whatever the user did if infix.
Split(Space.orNL(newlines == 0), 0)
)
case _: Defn.Val | _: Defn.Var =>
val indent = style.indent.getDefnSite(leftOwner)
Seq(
Split(Space, 0),
Split(Newline, 1).withIndent(indent, right, After)
)
case _ =>
Seq(
Split(Space, 0),
Split(Newline, 1)
)
}
}
case FormatToken(_, T.Semicolon(), _) =>
Expand Down

0 comments on commit b762f37

Please sign in to comment.