[PATCH] D63091: [clangd] Add a capability to enable completions with fixes.
Sam McCall via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 04:54:57 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363664: [clangd] Add a capability to enable completions with fixes. (authored by sammccall, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63091/new/
https://reviews.llvm.org/D63091
Files:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/clangd/Protocol.cpp
clang-tools-extra/trunk/clangd/Protocol.h
Index: clang-tools-extra/trunk/clangd/Protocol.h
===================================================================
--- clang-tools-extra/trunk/clangd/Protocol.h
+++ clang-tools-extra/trunk/clangd/Protocol.h
@@ -387,6 +387,11 @@
/// textDocument.completion.completionItem.snippetSupport
bool CompletionSnippets = false;
+ /// Client supports completions with additionalTextEdit near the cursor.
+ /// This is a clangd extension. (LSP says this is for unrelated text only).
+ /// textDocument.completion.editsNearCursor
+ bool CompletionFixes = false;
+
/// Client supports hierarchical document symbols.
bool HierarchicalDocumentSymbol = false;
Index: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
@@ -337,6 +337,7 @@
applyConfiguration(Params.initializationOptions.ConfigSettings);
CCOpts.EnableSnippets = Params.capabilities.CompletionSnippets;
+ CCOpts.IncludeFixIts = Params.capabilities.CompletionFixes;
DiagOpts.EmbedFixesInDiagnostics = Params.capabilities.DiagnosticFixes;
DiagOpts.SendDiagnosticCategory = Params.capabilities.DiagnosticCategory;
DiagOpts.EmitRelatedLocations =
Index: clang-tools-extra/trunk/clangd/Protocol.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/Protocol.cpp
+++ clang-tools-extra/trunk/clangd/Protocol.cpp
@@ -293,6 +293,8 @@
return false;
}
}
+ if (auto EditsNearCursor = Completion->getBoolean("editsNearCursor"))
+ R.CompletionFixes = *EditsNearCursor;
}
if (auto *CodeAction = TextDocument->getObject("codeAction")) {
if (CodeAction->getObject("codeActionLiteralSupport"))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63091.205308.patch
Type: text/x-patch
Size: 1853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190618/c5e3ff8f/attachment.bin>
More information about the llvm-commits
mailing list