1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

🔥 contextRows.

This commit is contained in:
Rob Rix 2016-03-03 10:15:23 -05:00
parent c64e3f7ca1
commit 6479f02047

View File

@ -81,10 +81,7 @@ splitAnnotatedByLines sources ranges categories syntax = case syntax of
Indexed children -> adjoinChildRows (Indexed . fmap copoint) (Identity <$> children)
Fixed children -> adjoinChildRows (Fixed . fmap copoint) (Identity <$> children)
Keyed children -> adjoinChildRows (Keyed . Map.fromList) (List.sortOn (diffRanges . Prelude.snd) $ Map.toList children)
where contextRows :: Both Range -> Both (Source Char) -> [Both Range]
contextRows ranges sources = sequenceA (actualLineRanges <$> ranges <*> sources)
adjoin :: Copointed f => [Row (Range, Maybe (f (SplitDiff leaf Info)))] -> [Row (Range, Maybe (f (SplitDiff leaf Info)))]
where adjoin :: Copointed f => [Row (Range, Maybe (f (SplitDiff leaf Info)))] -> [Row (Range, Maybe (f (SplitDiff leaf Info)))]
adjoin = reverse . foldl (adjoinRowsBy (openRangePair <$> sources)) []
adjoinChildRows :: (Copointed f, Functor f) => ([f (SplitDiff leaf Info)] -> Syntax leaf (SplitDiff leaf Info)) -> [f (Diff leaf Info)] -> [Row (SplitDiff leaf Info)]