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

Diagram

Rendering…

Example mental model (from module docstring):

text
ta.sma(close, 14)           →  ta.sma(source: close, length: 14)

Interface surface

MethodCapability
textDocument/inlayHintInlayHintOptions(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).

FieldValue
positionStart of the positional argument
label"{name}: "
kindInlayHintKind.Parameter
dataomitted
textEditsomitted (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.

PathRole
features/inlay_hints.pyCollection (display-only)
providers/builtin_metadata.pyParameter names

Invariants and edge cases

  1. Metadata quality bounds accuracy — missing param names yields no parameter hints.
  2. Hints never mutate the document. No textEdits, no data, no resolve handler; applying a hint is a client-side display action only.
  3. No inferred type hints. The server never annotates declarations — the show_types path and its inference helpers were removed.
  4. Malformed input does not throw — unparsable or empty sources return None / [].

Worked example

pinescript
//@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 float
  • avg → type from ta.sma detail (typically series float) or series
  • period → : input int
  • ta.sma(src, length) → source: before src, length: before length

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

SymptomCause
No hints on fileParse error → None
ta.* always : seriesMetadata detail lacks → segment
No source: / length: on a builtin callNot a dotted builtin, named kwargs, or metadata/snippet names missing
Applying a hint does nothingExpected: hints are display-only; there is no type injection
Hints mid-identifierIncorrect col_offset on AST node — builder issue

See also