From 8eb081b3dd74d549c2ebda3e630d0abfdfb71658 Mon Sep 17 00:00:00 2001 From: Ting-Gian LUA Date: Fri, 11 Dec 2020 18:36:21 +0800 Subject: [PATCH] Abstracting documentChangeUri --- src/Language/LSP/Test.hs | 7 ------- src/Language/LSP/Test/Session.hs | 3 ++- 2 files changed, 2 insertions(+), 8 deletions(-) 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 -- 2.30.2