[clang-tools-extra] 4da0eb5 - [clangd] Change completion-style default to detailed (#195963)
via cfe-commits
cfe-commits at lists.llvm.org
Wed May 6 22:48:29 PDT 2026
Author: timon-ul
Date: 2026-05-07T01:47:55-04:00
New Revision: 4da0eb5b91c9852145c9b39267f8198bc1732565
URL: https://github.com/llvm/llvm-project/commit/4da0eb5b91c9852145c9b39267f8198bc1732565
DIFF: https://github.com/llvm/llvm-project/commit/4da0eb5b91c9852145c9b39267f8198bc1732565.diff
LOG: [clangd] Change completion-style default to detailed (#195963)
Relevant discussion in https://github.com/clangd/clangd/discussions/2616
Added:
Modified:
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/CodeComplete.cpp
clang-tools-extra/clangd/CodeComplete.h
clang-tools-extra/docs/ReleaseNotes.rst
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index ebd42abd2dd61..245419dda9151 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 8414ffe20526a..9bd96ba96fcc0 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
diff erent 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.
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index a15cdb25caecf..c464be5f6311a 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -79,6 +79,14 @@ Code completion
- Now also provides include files without extension, if they are in a directory
only called ``include``.
+- 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
^^^^^^^^^^^^
More information about the cfe-commits
mailing list