diff options
| author | Sam McCall <sam.mccall@gmail.com> | 2019-06-18 11:57:26 +0000 |
|---|---|---|
| committer | Sam McCall <sam.mccall@gmail.com> | 2019-06-18 11:57:26 +0000 |
| commit | 8d41294c18930edb3f46f1e9d721ce6930bf9b99 (patch) | |
| tree | 16c04402018c84e6811c0004cdeba757a0eb5251 /clang-tools-extra/clangd | |
| parent | 8ddf31bc33e6c29dca82d640c0c9bab7a67080fa (diff) | |
| download | bcm5719-llvm-8d41294c18930edb3f46f1e9d721ce6930bf9b99.tar.gz bcm5719-llvm-8d41294c18930edb3f46f1e9d721ce6930bf9b99.zip | |
[clangd] Add a capability to enable completions with fixes.
Reviewers: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63091
llvm-svn: 363664
Diffstat (limited to 'clang-tools-extra/clangd')
| -rw-r--r-- | clang-tools-extra/clangd/ClangdLSPServer.cpp | 1 | ||||
| -rw-r--r-- | clang-tools-extra/clangd/Protocol.cpp | 2 | ||||
| -rw-r--r-- | clang-tools-extra/clangd/Protocol.h | 5 |
3 files changed, 8 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp index c8aaaea8d42..f6796e1e792 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.cpp +++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -337,6 +337,7 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params, 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 = diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp index bd8d0328a5b..17d070a3f7b 100644 --- a/clang-tools-extra/clangd/Protocol.cpp +++ b/clang-tools-extra/clangd/Protocol.cpp @@ -293,6 +293,8 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R) { return false; } } + if (auto EditsNearCursor = Completion->getBoolean("editsNearCursor")) + R.CompletionFixes = *EditsNearCursor; } if (auto *CodeAction = TextDocument->getObject("codeAction")) { if (CodeAction->getObject("codeActionLiteralSupport")) diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h index 00846b7a333..60772e9cb4b 100644 --- a/clang-tools-extra/clangd/Protocol.h +++ b/clang-tools-extra/clangd/Protocol.h @@ -387,6 +387,11 @@ struct ClientCapabilities { /// 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; |

