[PATCH] D63091: [clangd] Add a capability to enable completions with fixes.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 10 13:01:03 PDT 2019
sammccall created this revision.
sammccall added a reviewer: ilya-biryukov.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay.
Herald added a project: clang.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D63091
Files:
clangd/ClangdLSPServer.cpp
clangd/Protocol.cpp
clangd/Protocol.h
Index: clangd/Protocol.h
===================================================================
--- clangd/Protocol.h
+++ 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: clangd/Protocol.cpp
===================================================================
--- clangd/Protocol.cpp
+++ 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"))
Index: clangd/ClangdLSPServer.cpp
===================================================================
--- clangd/ClangdLSPServer.cpp
+++ 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 =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63091.203881.patch
Type: text/x-patch
Size: 1637 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190610/2da209dd/attachment.bin>
More information about the cfe-commits
mailing list