mirror of
https://github.com/github/semantic.git
synced 2024-12-27 00:44:57 +03:00
Partition the intersecting children instead of expecting them to be strictly ordered.
This commit is contained in:
parent
d821349e75
commit
07ba502d1d
@ -156,7 +156,7 @@ alignBranch getRange children ranges = case intersectingChildren of
|
||||
(rightLine, remainingAtRight) = maybe (id, []) (first (:)) $ rightRange >>= lineAndRemainingWhere (isThat . runJoin . head . copoint) asymmetricalChildren in
|
||||
leftLine $ rightLine $ alignBranch getRange (remainingAtLeft ++ remainingAtRight ++ nonIntersectingChildren) (modifyJoin (uncurry bimap (advancePast asymmetricalChildren)) ranges)
|
||||
where (intersectingChildren, nonIntersectingChildren) = partition (or . intersectsFirstLine headRanges) children
|
||||
(asymmetricalChildren, remainingIntersectingChildren) = break (isThese . runJoin . head . copoint) intersectingChildren
|
||||
(remainingIntersectingChildren, asymmetricalChildren) = partition (isThese . runJoin . head . copoint) intersectingChildren
|
||||
intersectsFirstLine ranges = maybe (False <$ ranges) (intersects getRange ranges) . listToMaybe . copoint
|
||||
Just headRanges = sequenceL $ listToMaybe <$> Join (runBothWith These ranges)
|
||||
(leftRange, rightRange) = splitThese headRanges
|
||||
|
Loading…
Reference in New Issue
Block a user