summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/Protocol.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2019-08-05 12:48:09 +0000
committerHaojian Wu <hokein@google.com>2019-08-05 12:48:09 +0000
commitf25163498b3d41e78bf751baa7b854cbf5d4b587 (patch)
tree0606124faa44d181b2175c25ebdc76b900450df7 /clang-tools-extra/clangd/Protocol.cpp
parente4bb2b181fc12be02b62d0ea71d0267c7b586b14 (diff)
downloadbcm5719-llvm-f25163498b3d41e78bf751baa7b854cbf5d4b587.tar.gz
bcm5719-llvm-f25163498b3d41e78bf751baa7b854cbf5d4b587.zip
[clangd] Add a callback mechanism for handling responses from client.
Summary: The callback will be invoked in clangd when we receive a reply from the client. This is a prerequisite of implementing a generic mechanism for chainable refactorings (e.g. extract variable and rename), this would allow server to trigger a new request to the LSP client after receiving a reply from the client. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65387 llvm-svn: 367845
Diffstat (limited to 'clang-tools-extra/clangd/Protocol.cpp')
-rw-r--r--clang-tools-extra/clangd/Protocol.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp
index 0c44928d224..fb1481da5b5 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -670,6 +670,15 @@ llvm::json::Value toJSON(const ApplyWorkspaceEditParams &Params) {
return llvm::json::Object{{"edit", Params.edit}};
}
+bool fromJSON(const llvm::json::Value &Response,
+ ApplyWorkspaceEditResponse &R) {
+ llvm::json::ObjectMapper O(Response);
+ if (!O || !O.map("applied", R.applied))
+ return false;
+ O.map("failureReason", R.failureReason);
+ return true;
+}
+
bool fromJSON(const llvm::json::Value &Params, TextDocumentPositionParams &R) {
llvm::json::ObjectMapper O(Params);
return O && O.map("textDocument", R.textDocument) &&
OpenPOWER on IntegriCloud