projects
/
lsp-test.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2e75030
)
Fix DocumentChange related stuff in Test.hs
author
Ting-Gian LUA
<banacorn@gmail.com>
Fri, 11 Dec 2020 10:13:08 +0000
(18:13 +0800)
committer
Ting-Gian LUA
<banacorn@gmail.com>
Fri, 11 Dec 2020 10:13:08 +0000
(18:13 +0800)
src/Language/LSP/Test.hs
patch
|
blob
|
history
diff --git
a/src/Language/LSP/Test.hs
b/src/Language/LSP/Test.hs
index 3eda63e90dd6fb39a936a431f68bac7042147da0..a068b0eda6bb9254e32aa49c4daadcb95716eb86 100644
(file)
--- a/
src/Language/LSP/Test.hs
+++ b/
src/Language/LSP/Test.hs
@@
-283,9
+283,16
@@
getDocumentEdit doc = do
documentContents doc
where
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
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
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])
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
else
let changes = HashMap.singleton (doc ^. uri) (List [edit])
in WorkspaceEdit (Just changes) Nothing