[PATCH] D66592: [clangd] Send suppported codeActionKinds to the client.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 22 07:51:26 PDT 2019
hokein updated this revision to Diff 216625.
hokein marked 3 inline comments as done.
hokein added a comment.
Fix the comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66592/new/
https://reviews.llvm.org/D66592
Files:
clang-tools-extra/clangd/ClangdLSPServer.cpp
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===================================================================
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -464,6 +464,16 @@
if (!Params.capabilities.RenamePrepareSupport) // Only boolean allowed per LSP
RenameProvider = true;
+ // Per LSP, codeActionProvide can be either boolean or CodeActionOptions.
+ // CodeActionOptions is only valid if the client supports action literal
+ // via textDocument.codeAction.codeActionLiteralSupport.
+ llvm::json::Value CodeActionProvider = true;
+ if (Params.capabilities.CodeActionStructure)
+ CodeActionProvider = llvm::json::Object{
+ {"codeActionKinds",
+ {CodeAction::QUICKFIX_KIND, CodeAction::REFACTOR_KIND,
+ CodeAction::INFO_KIND}}};
+
llvm::json::Object Result{
{{"capabilities",
llvm::json::Object{
@@ -475,7 +485,7 @@
{"firstTriggerCharacter", "\n"},
{"moreTriggerCharacter", {}},
}},
- {"codeActionProvider", true},
+ {"codeActionProvider", std::move(CodeActionProvider)},
{"completionProvider",
llvm::json::Object{
{"resolveProvider", false},
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66592.216625.patch
Type: text/x-patch
Size: 1287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190822/5688a50a/attachment-0001.bin>
More information about the cfe-commits
mailing list