From: Ting-Gian LUA Date: Fri, 11 Dec 2020 10:36:21 +0000 (+0800) Subject: Abstracting documentChangeUri X-Git-Tag: 0.13.0.0~6^2 X-Git-Url: https://git.lukelau.me/?p=lsp-test.git;a=commitdiff_plain;h=8eb081b3dd74d549c2ebda3e630d0abfdfb71658 Abstracting documentChangeUri --- diff --git a/src/Language/LSP/Test.hs b/src/Language/LSP/Test.hs index a068b0e..89abfcf 100644 --- a/src/Language/LSP/Test.hs +++ b/src/Language/LSP/Test.hs @@ -283,13 +283,6 @@ getDocumentEdit doc = do documentContents doc where - -- extract Uri out from DocumentChange - documentChangeUri :: DocumentChange -> Uri - documentChangeUri (InL x) = x ^. textDocument . uri - documentChangeUri (InR (InL x)) = x ^. uri - documentChangeUri (InR (InR (InL x))) = x ^. oldUri - documentChangeUri (InR (InR (InR x))) = x ^. uri - checkDocumentChanges req = let changes = req ^. params . edit . documentChanges maybeDocs = fmap (fmap documentChangeUri) changes diff --git a/src/Language/LSP/Test/Session.hs b/src/Language/LSP/Test/Session.hs index 3600739..ac668e6 100644 --- a/src/Language/LSP/Test/Session.hs +++ b/src/Language/LSP/Test/Session.hs @@ -29,6 +29,7 @@ module Language.LSP.Test.Session , bumpTimeoutId , logMsg , LogMsgType(..) + , documentChangeUri ) where @@ -296,8 +297,8 @@ updateStateC = awaitForever $ \msg -> do updateState msg yield msg - -- extract Uri out from DocumentChange +-- didn't put this in `lsp-types` because TH was getting in the way documentChangeUri :: DocumentChange -> Uri documentChangeUri (InL x) = x ^. textDocument . uri documentChangeUri (InR (InL x)) = x ^. uri