1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Aligned leaf diffs have per-line ranges.

This commit is contained in:
Rob Rix 2016-03-21 13:38:36 -04:00
parent 73f8cd56e0
commit 2f37ba14bc

View File

@ -122,7 +122,7 @@ alignDiff :: Both (Source Char) -> Diff leaf Info -> AlignedDiff leaf
alignDiff sources diff = iter alignSyntax (alignPatch sources <$> diff)
where alignSyntax :: Annotated leaf (Both Info) (AlignedDiff leaf) -> AlignedDiff leaf
alignSyntax (Annotated infos syntax) = case syntax of
Leaf s -> runBothWith ((Join .) . These) $ (\ info -> (Free (Annotated info (Leaf s)) <$)) <$> infos <*> lineRanges
Leaf s -> runBothWith ((Join .) . These) $ (\ info -> fmap (Free . (`Annotated` Leaf s) . setCharacterRange info)) <$> infos <*> lineRanges
_ -> Join (These [] [])
where lineRanges = actualLineRanges <$> (characterRange <$> infos) <*> sources