[clangd] Add add commit characters to the server capabilities

Summary:
Make it more convinient for the clients to select completion items by
providing a set of default characters (punctuation).

Related issue: https://github.com/clangd/clangd/issues/284

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D74606
This commit is contained in:
Kirill Bobyrev 2020-02-18 17:55:12 +01:00
parent 0dbc4658d8
commit 2a095ff6f5
No known key found for this signature in database
GPG Key ID: 2307C055C8384FA0
3 changed files with 4 additions and 0 deletions

View File

@ -559,6 +559,7 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
{"codeActionProvider", std::move(CodeActionProvider)},
{"completionProvider",
llvm::json::Object{
{"allCommitCharacters", " \t()[]{}<>:;,+-/*%^&#?.=\"'|"},
{"resolveProvider", false},
// We do extra checks for '>' and ':' in completion to only
// trigger on '->' and '::'.

View File

@ -1101,6 +1101,8 @@ struct CompletionItem {
/// the client side.
float score = 0.f;
// TODO: Add custom commitCharacters for some of the completion items. For
// example, it makes sense to use () only for the functions.
// TODO(krasimir): The following optional fields defined by the language
// server protocol are unsupported:
//

View File

@ -7,6 +7,7 @@
# CHECK-NEXT: "capabilities": {
# CHECK-NEXT: "codeActionProvider": true,
# CHECK-NEXT: "completionProvider": {
# CHECK-NEXT: "allCommitCharacters": " \t()[]{}<>:;,+-/*%^&#?.=\"",
# CHECK-NEXT: "resolveProvider": false,
# CHECK-NEXT: "triggerCharacters": [
# CHECK-NEXT: ".",