From 56c39e493dfc0bf610e3807f69ccc7af8549d3e3 Mon Sep 17 00:00:00 2001 From: Ting-Gian LUA Date: Fri, 11 Dec 2020 18:13:08 +0800 Subject: [PATCH] Fix DocumentChange related stuff in Test.hs --- src/Language/LSP/Test.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Language/LSP/Test.hs b/src/Language/LSP/Test.hs index 3eda63e..a068b0e 100644 --- a/src/Language/LSP/Test.hs +++ b/src/Language/LSP/Test.hs @@ -283,9 +283,16 @@ 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 (^. textDocument . uri)) changes + maybeDocs = fmap (fmap documentChangeUri) changes in case maybeDocs of Just docs -> (doc ^. uri) `elem` docs Nothing -> False @@ -583,7 +590,7 @@ applyEdit doc edit = do let wEdit = if supportsDocChanges then let docEdit = TextDocumentEdit verDoc (List [edit]) - in WorkspaceEdit Nothing (Just (List [docEdit])) + in WorkspaceEdit Nothing (Just (List [InL docEdit])) else let changes = HashMap.singleton (doc ^. uri) (List [edit]) in WorkspaceEdit (Just changes) Nothing -- 2.30.2