Skip to content

Commit

Permalink
FormatOps: single-line infix until op, not lhs
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Dec 10, 2021
1 parent d44c4d3 commit 5290f56
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1745,10 +1745,14 @@ class FormatOps(
case _ => getSlbSplits()
}
case InfixApp(ia) =>
val left = findLeftInfix(ia).lhs
val (callPolicy, isCallSite) = CallSite.getFoldedPolicies(left)
val lia = findLeftInfix(ia)
val (callPolicy, isCallSite) = CallSite.getFoldedPolicies(lia.lhs)
if (isCallSite) getPolicySplits(0, callPolicy)
else getSplits(getSlbSplit(getLastToken(left)))
else {
val lp = body.tokens.headOption.filter(_.is[T.LeftParen])
val ok = lp.flatMap(matchingOpt).exists(_.end >= lia.op.pos.end)
getSplits(getSlbSplit(getLastToken(if (ok) lia.lhs else lia.op)))
}
case _ =>
val (callPolicy, isCallSite) = CallSite.getFoldedPolicies(body)
getPolicySplits(if (isCallSite) 0 else 1, callPolicy)
Expand Down

0 comments on commit 5290f56

Please sign in to comment.