Inlay Hints
Display-only builtin parameter names. Hints never insert text or modify the document.
This page
Abstract
Inlay hints surface parameter names before positional arguments of builtin and user function/method calls (ta.sma(close, 14) → source: / length:). Only confident cases are emitted: ambiguous receivers are skipped rather than guessed wrong. Hints are filtered to the client's requested range. Hints are display-only: the server does not advertise or implement inlayHint/resolve, emits no data, and never sets textEdits, so a hint can never be injected into the source. Inferred assignment type hints were removed entirely — the server never annotates declarations.
Conceptual model
Rendering…
Example mental model (from module docstring):
ta.sma(close, 14) → ta.sma(source: close, length: 14)
Interface surface
| Method | Capability |
|---|---|
textDocument/inlayHint | InlayHintOptions(resolve_provider=False) |
Handler: features/inlay_hints.py → handle_inlay_hints (receives the version-matched tree=doc.valid_ast). There is no inlayHint/resolve handler and no document mutation path.
Parameter-name hints
Emitted for positional args of module.attr(...) when get_builtin("module.attr") hits. Real snippet placeholder names win; generic paramN snippets fall through to the longest of the detail signature, documentation, and a well-known Pine v6 map (ta.sma/ema/rsi → source/length, ta.atr → length, ta.correlation → source1/source2/length, strategy.entry → id/direction/qty, input.int → defval/title, plus ta.cci/roc/mom/linreg/adx/mfi/bbw/dpo/crossover/crossunder).
| Field | Value |
|---|---|
position | Start of the positional argument |
label | "{name}: " |
kind | InlayHintKind.Parameter |
data | omitted |
textEdits | omitted (display-only) |
Named kwargs (length=14) skip the matching slot.
handle_inlay_hints returns [] for empty source, None if parse fails (client typically treats as no hints).
Internals
Walk
Recursive over _fields (same pattern as workspace symbol collection) — not limited to script top-level; nested calls can receive hints.
| Path | Role |
|---|---|
features/inlay_hints.py | Collection (display-only) |
providers/builtin_metadata.py | Parameter names |
Invariants and edge cases
- Metadata quality bounds accuracy — missing param names yields no parameter hints.
- Hints never mutate the document. No
textEdits, nodata, no resolve handler; applying a hint is a client-side display action only. - No inferred type hints. The server never annotates declarations — the
show_typespath and its inference helpers were removed. - Malformed input does not throw — unparsable or empty sources return
None/[].
Worked example
//@version=6
indicator("hints")
length = 14
src = close
avg = ta.sma(src, length)
period = input.int(20, "Period")
Expected hints (when parse + metadata succeed):
length→: const int(type)src→: series floatavg→ type fromta.smadetail (typically series float) orseriesperiod→: input intta.sma(src, length)→source:beforesrc,length:beforelength
avg will not get a hint derived from length’s type through the call graph — only the call’s known return shape. Clicking a hint never edits the call or the declaration.
Failure modes
| Symptom | Cause |
|---|---|
| No hints on file | Parse error → None |
ta.* always : series | Metadata detail lacks → segment |
No source: / length: on a builtin call | Not a dotted builtin, named kwargs, or metadata/snippet names missing |
| Applying a hint does nothing | Expected: hints are display-only; there is no type injection |
| Hints mid-identifier | Incorrect col_offset on AST node — builder issue |