Index: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp =================================================================== --- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp +++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp @@ -366,6 +366,8 @@ CCOpts.EnableSnippets = Params.capabilities.CompletionSnippets; CCOpts.IncludeFixIts = Params.capabilities.CompletionFixes; + if (!CCOpts.BundleOverloads.hasValue()) + CCOpts.BundleOverloads = Params.capabilities.HasSignatureHelp; DiagOpts.EmbedFixesInDiagnostics = Params.capabilities.DiagnosticFixes; DiagOpts.SendDiagnosticCategory = Params.capabilities.DiagnosticCategory; DiagOpts.EmitRelatedLocations = Index: clang-tools-extra/trunk/clangd/CodeComplete.h =================================================================== --- clang-tools-extra/trunk/clangd/CodeComplete.h +++ clang-tools-extra/trunk/clangd/CodeComplete.h @@ -62,7 +62,10 @@ bool IncludeIneligibleResults = false; /// Combine overloads into a single completion item where possible. - bool BundleOverloads = false; + /// If none, the the implementation may choose an appropriate behavior. + /// (In practice, ClangdLSPServer enables bundling if the client claims + /// to supports signature help). + llvm::Optional BundleOverloads; /// Limit the number of results returned (0 means no limit). /// If more results are available, we set CompletionList.isIncomplete. Index: clang-tools-extra/trunk/clangd/CodeComplete.cpp =================================================================== --- clang-tools-extra/trunk/clangd/CodeComplete.cpp +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp @@ -169,7 +169,7 @@ // Returns a token identifying the overload set this is part of. // 0 indicates it's not part of any overload set. size_t overloadSet(const CodeCompleteOptions &Opts) const { - if (!Opts.BundleOverloads) + if (!Opts.BundleOverloads.getValueOr(false)) return 0; llvm::SmallString<256> Scratch; if (IndexResult) { Index: clang-tools-extra/trunk/clangd/Protocol.h =================================================================== --- clang-tools-extra/trunk/clangd/Protocol.h +++ clang-tools-extra/trunk/clangd/Protocol.h @@ -393,9 +393,15 @@ bool CompletionFixes = false; /// Client supports hierarchical document symbols. + /// textDocument.documentSymbol.hierarchicalDocumentSymbolSupport bool HierarchicalDocumentSymbol = false; + /// Client supports signature help. + /// textDocument.signatureHelp + bool HasSignatureHelp = false; + /// Client supports processing label offsets instead of a simple label string. + /// textDocument.signatureHelp.signatureInformation.parameterInformation.labelOffsetSupport bool OffsetsInSignatureHelp = false; /// The supported set of CompletionItemKinds for textDocument/completion. @@ -407,12 +413,14 @@ bool CodeActionStructure = false; /// Client supports semantic highlighting. + /// textDocument.semanticHighlightingCapabilities.semanticHighlighting bool SemanticHighlighting = false; /// Supported encodings for LSP character offsets. (clangd extension). llvm::Optional> offsetEncoding; /// The content format that should be used for Hover requests. + /// textDocument.hover.contentEncoding MarkupKind HoverContentFormat = MarkupKind::PlainText; }; bool fromJSON(const llvm::json::Value &, ClientCapabilities &); Index: clang-tools-extra/trunk/clangd/Protocol.cpp =================================================================== --- clang-tools-extra/trunk/clangd/Protocol.cpp +++ clang-tools-extra/trunk/clangd/Protocol.cpp @@ -323,6 +323,7 @@ } } if (auto *Help = TextDocument->getObject("signatureHelp")) { + R.HasSignatureHelp = true; if (auto *Info = Help->getObject("signatureInformation")) { if (auto *Parameter = Info->getObject("parameterInformation")) { if (auto OffsetSupport = Parameter->getBoolean("labelOffsetSupport")) Index: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp =================================================================== --- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp +++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp @@ -58,8 +58,7 @@ "completion, with full type information"), clEnumValN(Bundled, "bundled", "Similar completion items (e.g. function overloads) are " - "combined. Type information shown where possible")), - llvm::cl::init(Detailed)); + "combined. Type information shown where possible"))); // FIXME: Flags are the wrong mechanism for user preferences. // We should probably read a dotfile or similar. @@ -487,7 +486,8 @@ clangd::CodeCompleteOptions CCOpts; CCOpts.IncludeIneligibleResults = IncludeIneligibleResults; CCOpts.Limit = LimitResults; - CCOpts.BundleOverloads = CompletionStyle != Detailed; + if (CompletionStyle.getNumOccurrences()) + CCOpts.BundleOverloads = CompletionStyle != Detailed; CCOpts.ShowOrigins = ShowOrigins; CCOpts.InsertIncludes = HeaderInsertion; if (!HeaderInsertionDecorators) {