summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/Protocol.cpp
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2019-06-18 13:37:54 +0000
committerSam McCall <sam.mccall@gmail.com>2019-06-18 13:37:54 +0000
commit395fde753c912e66964e1ce097f1ea6c59c79576 (patch)
tree97b67d073885fd02ac96384d26e41bcdafd218c2 /clang-tools-extra/clangd/Protocol.cpp
parent45b10d2da5c92aa792acd282ba85c7c4f6e97f2f (diff)
downloadbcm5719-llvm-395fde753c912e66964e1ce097f1ea6c59c79576.tar.gz
bcm5719-llvm-395fde753c912e66964e1ce097f1ea6c59c79576.zip
[clangd] Add hidden tweaks to dump AST/selection.
Summary: This introduces a few new concepts: - tweaks have an Intent (they don't all advertise as refactorings) - tweaks may produce messages (for ShowMessage notification). Generalized Replacements -> Effect. - tweaks (and other features) may be hidden (clangd -hidden-features flag). We may choose to promote these one day. I'm not sure they're worth their own feature flags though. Verified it in vim-clangd (not yet open source), curious if the UI is ok in VSCode. Reviewers: ilya-biryukov Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62538 llvm-svn: 363680
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 17d070a3f7b..f8becaaa361 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -359,6 +359,14 @@ bool fromJSON(const llvm::json::Value &Params, InitializeParams &R) {
return true;
}
+llvm::json::Value toJSON(const MessageType &R) {
+ return static_cast<int64_t>(R);
+}
+
+llvm::json::Value toJSON(const ShowMessageParams &R) {
+ return llvm::json::Object{{"type", R.type}, {"message", R.message}};
+}
+
bool fromJSON(const llvm::json::Value &Params, DidOpenTextDocumentParams &R) {
llvm::json::ObjectMapper O(Params);
return O && O.map("textDocument", R.textDocument);
@@ -593,6 +601,7 @@ llvm::json::Value toJSON(const Command &C) {
const llvm::StringLiteral CodeAction::QUICKFIX_KIND = "quickfix";
const llvm::StringLiteral CodeAction::REFACTOR_KIND = "refactor";
+const llvm::StringLiteral CodeAction::INFO_KIND = "info";
llvm::json::Value toJSON(const CodeAction &CA) {
auto CodeAction = llvm::json::Object{{"title", CA.title}};
OpenPOWER on IntegriCloud