1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Sort the produced children by range.

This commit is contained in:
Rob Rix 2016-05-30 19:21:06 -04:00
parent e44d629380
commit b7e724effd

View File

@ -104,7 +104,7 @@ alignBranch getRange children ranges = case intersectingChildren of
line $ alignBranch getRange (remaining ++ symmetricalChildren ++ nonIntersectingChildren) (modifyJoin (advanceBy (drop 1)) ranges)
lineAndRemaining _ Nothing = (identity, [])
lineAndRemaining children (Just ranges) = let (intersections, remaining) = alignChildren getRange children ranges in
((:) $ (,) <$> ranges `applyToBoth` intersections, remaining)
((:) $ (,) <$> ranges `applyToBoth` (sortBy (compare `on` getRange) <$> intersections), remaining)
-- | Given a list of aligned children, produce lists of their intersecting first lines, and a list of the remaining lines/nonintersecting first lines.
alignChildren :: (term -> Range) -> [Join These (term)] -> Join These Range -> (Both [term], [Join These term])