Abstracting documentChangeUri
authorTing-Gian LUA <banacorn@gmail.com>
Fri, 11 Dec 2020 10:36:21 +0000 (18:36 +0800)
committerTing-Gian LUA <banacorn@gmail.com>
Fri, 11 Dec 2020 10:36:21 +0000 (18:36 +0800)
src/Language/LSP/Test.hs
src/Language/LSP/Test/Session.hs

index a068b0eda6bb9254e32aa49c4daadcb95716eb86..89abfcf8b7a0c275c2903e9de9c9833c88b61bdf 100644 (file)
@@ -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
index 36007391c35965676be1a5f87a337e33947a3afb..ac668e6fab51dc0254edcc4252779e51c573e802 100644 (file)
@@ -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