Skip to content

Commit

Permalink
FormatWriter: consolidate multiple align cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Sep 1, 2024
1 parent 8d4214c commit 2ce2a38
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,10 @@ class FormatWriter(formatOps: FormatOps) {
)(implicit fl: FormatLocation): (Tree, Int) =
maybeParent.orElse(child.parent) match {
case Some(AlignContainer(p)) => (p, depth)
case Some(p @ (_: Term.Select | _: Pat.Var | _: Term.ApplyInfix)) =>
getAlignContainerParent(p, depth)
case Some(
p @ (_: Term.Select | _: Pat.Var | _: Term.ApplyInfix |
_: Member.ParamClauseGroup),
) => getAlignContainerParent(p, depth)
case Some(p: Term.Apply) if (p.argClause.values match {
case (_: Term.Apply) :: Nil => true
case _ => p.fun eq child
Expand Down Expand Up @@ -1314,8 +1316,6 @@ class FormatWriter(formatOps: FormatOps) {
case Some(p: Member.SyntaxValuesClause) =>
val isEnclosed = isEnclosedInMatching(p)
getAlignContainerParent(p, if (isEnclosed) depth + 1 else depth)
case Some(p: Member.ParamClauseGroup) =>
getAlignContainerParent(p, depth)
case Some(p) => (p.parent.getOrElse(p), depth)
case _ => (child, depth)
}
Expand Down

0 comments on commit 2ce2a38

Please sign in to comment.