mirror of
https://github.com/github/semantic.git
synced 2025-01-03 21:16:12 +03:00
🔥 openDiff.
This commit is contained in:
parent
8e78339c39
commit
c19073ab84
@ -120,10 +120,3 @@ openRange :: Source Char -> MaybeOpen Range
|
|||||||
openRange source range = case (source `at`) <$> maybeLastIndex range of
|
openRange source range = case (source `at`) <$> maybeLastIndex range of
|
||||||
Just '\n' -> Nothing
|
Just '\n' -> Nothing
|
||||||
_ -> Just range
|
_ -> Just range
|
||||||
|
|
||||||
-- | Given a source and something that has a split diff, returns nothing if the
|
|
||||||
-- | diff ends with a `\n`; otherwise returns the diff.
|
|
||||||
openDiff :: Copointed f => Source Char -> MaybeOpen (f (SplitDiff leaf Info))
|
|
||||||
openDiff source diff = const diff <$> case copoint diff of
|
|
||||||
(Free (Annotated (Info range _) _)) -> openRange source range
|
|
||||||
(Pure patch) -> let Info range _ :< _ = getSplitTerm patch in openRange source range
|
|
||||||
|
Loading…
Reference in New Issue
Block a user