Inlay Hints
Parameter Name Hints
Named parameter hints at call sites
Skip when argument name matches parameter name
Skip for single-parameter calls with obvious semantics
Expand parameter packs (
underlying_pack_typedetection)Resolve parameter names from definition (not just declaration)
Forwarding function parameter resolution — show the underlying constructor parameters for
std::make_unique,emplace_back, etc. (clangd#2324)cppstruct Widget { Widget(int width, int height); }; auto p = std::make_unique<Widget>(800, 600); // ^^^ ^^^ // width: 800, height: 600 (not __args: 800, __args: 600)Function pointer and
operator()parameter hints (clangd#1734, clangd#1742)cppvoid (*callback)(int status, const char* msg); callback(0, "ok"); // ^ ^^ // status: 0, msg: "ok" auto cmp = [](int a, int b) { return a < b; }; cmp(1, 2); // ^ ^ // a: 1, b: 2Template parameter hints — show deduced/explicit template arguments (clangd#2583)
cpptemplate<typename T, typename U> auto convert(U val) -> T; convert<float>(42); // ^^^^^ ^^ // T: float, val: 42Case-insensitive parameter name matching —
aParamshould suppress hint for argumentparam(clangd#2248)Suppress hints when an inline comment already names the parameter (clangd#1877)
cppdraw(/*x=*/10, /*y=*/20); // no hints needed — inline comments serve the same purposeDefault argument value hints
Type Hints
autodeduced type hintsStructured binding type hints
Lambda return type hints
Range-based for loop variable type hints
Lambda init-capture type hints (clangd#1163)
cppauto f = [val = compute()] {}; // ^^^ : intDependent
autotype hints — show deduced type when useful even in template bodies (clangd#2275)Don't show type hint when deduction fails (clangd#1475)
Don't show type hint when the type is explicitly specified (clangd#1749)
cppauto x = static_cast<int>(val); // no type hint — already explicit auto y = int{42}; // samePrefer desugared types — show
std::vector<int>rather than a typedef alias (clangd#1298, clangd#1668)cppusing IntVec = std::vector<int>; IntVec create(); auto v = create(); // ^ : std::vector<int> (not IntVec)Configurable type hint length limit (clangd#1357)
Abbreviated type hints with expandable label parts — use LSP
InlayHintLabelPartto allow expanding truncated types (clangd#2269)auto it = map.begin(); // ^^ : map<str…, int>::iterator [click to expand]Shorten hints by suppressing obvious scopes (clangd#2270)
cpp// inside namespace foo: auto x = create(); // ^ : Bar (not foo::Bar)
Designator Hints
Aggregate initializer designators (
.field =) — show field names for positional aggregate initializationcppstruct Point { int x, y, z; }; Point p = {1, 2, 3}; // ^ ^ ^ // .x = 1, .y = 2, .z = 3Parenthesized aggregate initialization (C++20) (clangd#2540)
cppPoint p(1, 2, 3); // ^ ^ ^ // .x = 1, .y = 2, .z = 3Compact array designator formatting (clangd#2303)
cppint arr[] = {10, 20, 30}; // ^^ ^^ ^^ // [0]= 10, [1]= 20, [2]= 30
Implicit Conversion Hints
Show implicit type conversions at call sites and assignments (clangd#2254)
cppvoid process(double val); process(42); // ^^ // (double) 42 — implicit int→double conversion std::string s = "hello"; // ^^^^^^^ // (std::string) "hello" — implicit const char*→string conversion
Reference / Pointer Hints
Show
&/&&to indicate the argument is passed by mutable reference (clangd#1123)cppvoid sort(std::vector<int>& v); sort(data); // ^^^^ // &data — passed by mutable reference
Template Argument Hints
CTAD deduced template arguments (clangd#2331)
cppstd::pair p(1, 3.14); // ^ <int, double>
Block End Hints
Show the declared name after a closing brace for long blocks (clangd#1634)
cppvoid Widget::processData(const Config& cfg) { // ... 50+ lines ... } // Widget::processData#endifhints — show the corresponding macro condition (clangd#2487)cpp#ifdef _WIN32 // ... #endif // _WIN32
Interactive Hints
Range-filtered results (hints outside the requested range are discarded; AST traversal is not range-limited)
Left-anchored hints (parameter names before argument)
Right-anchored hints (types after variable name)
Clickable type names — go-to-definition on hinted type names via LSP
InlayHintLabelPart(clangd#1535)auto widget = create(); // ^^^^^^ : Widget ← click "Widget" to go to Widget's definition
Hint Correctness
Known issues that should be handled correctly:
- Nested macro invocations must not produce incorrect parameter name hints (clangd#2620)
- No duplicate hints in the presence of explicit function template instantiation (clangd#1034)
- Parameter hints for inherited constructors called from derived classes (clangd#1364)
- Parameter hints must not be lost when a coroutine returns a template type (clangd#2437)
- C++23 deducing
this— strip explicit object parameter from hint display (clangd#1777)
Changelog
| Date | Change | PR |
|---|---|---|
| — | Parameter name hints, type hints, range-scoped queries | — |