mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Implement alignPatch over Delete/Insert.
This commit is contained in:
parent
881d902d3c
commit
84fc0a54a9
@ -114,10 +114,9 @@ type Row a = Both (Line a)
|
||||
type AlignedDiff leaf = [Join These (SplitDiff leaf Info)]
|
||||
|
||||
alignPatch :: Both (Source Char) -> Patch (Term leaf Info) -> AlignedDiff leaf
|
||||
alignPatch sources (Delete term) = hylo (alignSyntax (Join . This . runIdentity) (Identity $ fst sources)) unCofree (Identity <$> term)
|
||||
alignPatch sources (Insert term) = hylo (alignSyntax (Join . That . runIdentity) (Identity $ snd sources)) unCofree (Identity <$> term)
|
||||
alignPatch _ _ = []
|
||||
-- alignPatch sources patch = crosswalk (hylo (alignTerm sources) unCofree) (unPatch patch)
|
||||
-- alignPatch sources (Insert term) = hylo (alignTerm sources) unCofree term
|
||||
-- alignPatch sources (Delete term) = hylo (alignTerm sources) unCofree term
|
||||
-- alignPatch sources (Replace term1 term2) = alignWith Join (hylo (alignTerm sources) unCofree term1)
|
||||
-- (hylo (alignTerm sources) unCofree term2)
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user