mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
(Incorrect) rendering of indexed nodes to rows.
This commit is contained in:
parent
80dcd8efae
commit
51db79e961
10
app/Split.hs
10
app/Split.hs
@ -35,6 +35,16 @@ annotationAndSyntaxToRows left leftCategories right rightCategories (Leaf _) bef
|
|||||||
leftElements = Span (classify leftCategories) <$> lines (substring left before)
|
leftElements = Span (classify leftCategories) <$> lines (substring left before)
|
||||||
rightElements = Span (classify rightCategories) <$> lines (substring right after)
|
rightElements = Span (classify rightCategories) <$> lines (substring right after)
|
||||||
|
|
||||||
|
annotationAndSyntaxToRows left leftCategories right rightCategories (Indexed i) before after = snd $ foldl accumulateContext ((start left, start right), []) i
|
||||||
|
where
|
||||||
|
accumulateContext ((previousLeft, previousRight), rows) child
|
||||||
|
| (childRows, left, right) <- diffToRows child before after = ((end left, end right), rows ++ contextRows ++ childRows)
|
||||||
|
where
|
||||||
|
contextRows :: [Row]
|
||||||
|
contextRows = uncurry Row <$> zipMaybe leftElements rightElements
|
||||||
|
leftElements = Text <$> lines (substring (Range previousLeft $ start left) before)
|
||||||
|
rightElements = Text <$> lines (substring (Range previousRight $ start right) before)
|
||||||
|
|
||||||
zipMaybe :: [a] -> [b] -> [(Maybe a, Maybe b)]
|
zipMaybe :: [a] -> [b] -> [(Maybe a, Maybe b)]
|
||||||
zipMaybe la lb = take len $ zip la' lb'
|
zipMaybe la lb = take len $ zip la' lb'
|
||||||
where
|
where
|
||||||
|
Loading…
Reference in New Issue
Block a user