Signature Help
Trigger Characters
Registered: (, ), {, }, <, >, ,
| Character | Context | Behavior |
|---|---|---|
( | Function call | Show overload signatures |
) | Close paren | Update context |
{ | Brace init | Show overload signatures |
} | Close brace | Update context |
< | Template args | Show overload signatures |
> | Template close | Update context |
, | Argument separator | Update active parameter |
Avoid false triggers — don't fire inside comments, string literals, or when defining a function (clangd#51, clangd#289)
cppvoid foo(int x, int y) { // should NOT trigger signature help // ^^^^^^^^^^^^^ this is a definition, not a callnewexpression with braces should trigger signature help (clangd#1967)cppauto* w = new Widget{800, 600}; // ^ should trigger signature help for Widget constructors
Overload Signatures
Function overload signatures
Active parameter tracking
Template instantiation pattern resolution (shows template pattern, not instantiation)
Parameter labels with types
Return type in signature label
Parameter label byte offsets for precise highlighting
Filter const/non-const overload duplicates — don't show both when only one is viable (clangd#50)
cppstruct Vec { int& operator[](size_t); const int& operator[](size_t) const; }; Vec v; v[0]; // only show non-const overload (v is non-const)Prefer user-supplied constructors over compiler-generated ones (clangd#1259)
Filter dependent overload candidates by arity (clangd#2342)
cpptemplate<typename T> void process(T& obj) { obj.foo(1, 2); // if T has foo(int) and foo(int,int), only show foo(int,int) as viable }Better heuristic resolution of dependent overloads (clangd#1083)
Strip C++23 explicit object parameter from displayed signatures (clangd#2284)
cppstruct S { void f(this S& self, int x); }; S s; s.f(^ // show "(int x)", not "(this S& self, int x)"
Special Call Contexts
Template argument signature help (clangd#299, clangd#1387)
cpptemplate<typename Key, typename Value, typename Compare = less<Key>> class SortedMap; SortedMap<int, ^ // show: Key = int, Value = ?, Compare = less<Key>Aggregate initialization — show field names as "parameters" (clangd#726, clangd#2541)
cppstruct Point { int x, y, z; }; Point p = {1, ^ // show: .x = int, .y = int, .z = int (active: .y)Inherited constructors — show base class constructors when calling from derived (clangd#1363)
cppstruct Base { Base(int x, int y); }; struct Derived : Base { using Base::Base; }; Derived d(^ // show Base(int x, int y)operator[]signature help (clangd#2472)cppstd::map<std::string, int> m; m[^ // show operator[](const string& key)Lambda calls — show lambda name instead of
operator()(clangd#86)cppauto validate = [](int x, int max) -> bool { ... }; validate(^ // show "validate(int x, int max) -> bool", not "operator()(int x, int max)"Function pointer calls — show parameter names (clangd#1068, clangd#1729)
cppvoid (*callback)(int status, const char* msg); callback(^ // show "(int status, const char* msg)"Constructor signature help during object initialization
Macro function calls — show macro parameters, not the underlying expansion (clangd#795)
cpp#define CHECK(cond, msg) do { if (!(cond)) fail(msg); } while(0) CHECK(^ // show "CHECK(cond, msg)", not "fail(const char*)"
Parameter Display
Forwarding function parameter resolution — show underlying constructor parameters for
std::make_unique,emplace_back, etc. (clangd#517)cppstruct Widget { Widget(int width, int height); }; std::make_unique<Widget>(^ // show "(int width, int height)"Parameter pack display (clangd#638)
cpptemplate<typename... Args> void log(const char* fmt, Args&&... args); log("x=%d y=%d", ^ // show "fmt, args..." with active parameter on argsPrettify standard library parameter names (clangd#736)
// current: push_back(const value_type& __x) // expected: push_back(const value_type& value)Preserve enum class scope in parameter types (clangd#2475)
cppenum class Color { Red, Green, Blue }; void paint(Color c); paint(^ // show "(Color c)", not "(c)" with scope strippedShow default parameter values
cppvoid open(std::string path, int mode = 0644); open("file", ^ // show "int mode = 0644" (active), user knows it can be omitted
Documentation
Documentation for the active parameter (from
@paramdoc comments)cpp/// @param path The file system path. /// @param mode POSIX file permission bits. void open(std::string path, int mode); open("file", ^ // show documentation for mode parameterRespect
documentationFormatcapability (clangd#945)Propagate documentation through inherited constructors (clangd#1936)
Overload set count indicator
Changelog
| Date | Change | PR |
|---|---|---|
| — | Function overload signatures, active parameter tracking, trigger characters | — |