https://github.com/timon-ul updated https://github.com/llvm/llvm-project/pull/195963
>From d2588e760a7ce0da671add8c224c13a3c61b4fcf Mon Sep 17 00:00:00 2001 From: timon-ul <[email protected]> Date: Wed, 6 May 2026 01:28:28 +0200 Subject: [PATCH 1/2] [clangd] Change completion-style default to detailed Relevant discussion in https://github.com/clangd/clangd/discussions/2616#discussioncomment-16110659 --- clang-tools-extra/clangd/ClangdLSPServer.cpp | 2 -- clang-tools-extra/clangd/CodeComplete.cpp | 2 +- clang-tools-extra/clangd/CodeComplete.h | 5 +---- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp index 761b07eceec83..92ae7ccd2b685 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.cpp +++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -518,8 +518,6 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params, Opts.CodeComplete.EnableSnippets = Params.capabilities.CompletionSnippets; Opts.CodeComplete.IncludeFixIts = Params.capabilities.CompletionFixes; - if (!Opts.CodeComplete.BundleOverloads) - Opts.CodeComplete.BundleOverloads = Params.capabilities.HasSignatureHelp; Opts.CodeComplete.DocumentationFormat = Params.capabilities.CompletionDocumentationFormat; Opts.SignatureHelpDocumentationFormat = diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index f43b5e71a1dfa..3a9631ad04b31 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -234,7 +234,7 @@ struct CompletionCandidate { size_t overloadSet(const CodeCompleteOptions &Opts, llvm::StringRef FileName, IncludeInserter *Inserter, CodeCompletionContext::Kind CCContextKind) const { - if (!Opts.BundleOverloads.value_or(false)) + if (!Opts.BundleOverloads) return 0; // Depending on the index implementation, we can see different header diff --git a/clang-tools-extra/clangd/CodeComplete.h b/clang-tools-extra/clangd/CodeComplete.h index cde22a8212e6a..b466965cfff4e 100644 --- a/clang-tools-extra/clangd/CodeComplete.h +++ b/clang-tools-extra/clangd/CodeComplete.h @@ -59,10 +59,7 @@ struct CodeCompleteOptions { bool ForceLoadPreamble = false; /// Combine overloads into a single completion item where possible. - /// If none, the implementation may choose an appropriate behavior. - /// (In practice, ClangdLSPServer enables bundling if the client claims - /// to supports signature help). - std::optional<bool> BundleOverloads; + bool BundleOverloads = false; /// Limit the number of results returned (0 means no limit). /// If more results are available, we set CompletionList.isIncomplete. >From 1f867af44c2da5e22681151360255e03841907c9 Mon Sep 17 00:00:00 2001 From: timon-ul <[email protected]> Date: Wed, 6 May 2026 08:52:06 +0200 Subject: [PATCH 2/2] added release notes to notify the user of the new behaviour --- clang-tools-extra/docs/ReleaseNotes.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index c7ec5ae66499b..ec63659708032 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -116,6 +116,14 @@ Code completion macros. ``ExactPrefix`` is the default, which retains previous behavior of suggesting macros which match the prefix exactly. +- Changed completion-style default to ``detailed``. This means function + overloads will no longer be bundled together, but instead each have + their own completion item. This gives the user a better overview of the + possible overloads and also when accepting the item it will generate + placeholder parameters, which was not possible due to ambiguity with + ``bundled``. To change back to the old behaviour, pass the argument + ``--completion-style=bundled`` to clangd. + Code actions ^^^^^^^^^^^^ _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
