mirror of
https://github.com/github/semantic.git
synced 2024-12-01 00:33:59 +03:00
Sort the produced children by range.
This commit is contained in:
parent
e44d629380
commit
b7e724effd
@ -104,7 +104,7 @@ alignBranch getRange children ranges = case intersectingChildren of
|
|||||||
line $ alignBranch getRange (remaining ++ symmetricalChildren ++ nonIntersectingChildren) (modifyJoin (advanceBy (drop 1)) ranges)
|
line $ alignBranch getRange (remaining ++ symmetricalChildren ++ nonIntersectingChildren) (modifyJoin (advanceBy (drop 1)) ranges)
|
||||||
lineAndRemaining _ Nothing = (identity, [])
|
lineAndRemaining _ Nothing = (identity, [])
|
||||||
lineAndRemaining children (Just ranges) = let (intersections, remaining) = alignChildren getRange children ranges in
|
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.
|
-- | 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])
|
alignChildren :: (term -> Range) -> [Join These (term)] -> Join These Range -> (Both [term], [Join These term])
|
||||||
|
Loading…
Reference in New Issue
Block a user