Skip to main content

Module locals_nav

Module locals_nav 

Source
Expand description

v0.31 (ADR 0064): locals navigation — resolve the local binding under the cursor and all its sites (its definition plus every use that resolves to it), for references, go-to-definition, and documentHighlight.

Slice 1 records bindings with scope ranges (not use sites); the use sites are recovered here by lexing the file and keeping the identifier tokens of the binding’s name within its scope that resolve back to it (so a shadowing inner binding’s uses — and every binding’s def token — are excluded). Pure over the analysed snapshot, like index_queries.

Structs§

InlineValueSite
#2476: one variable the editor should show inline while a debugger is paused — where it is declared and the name the emitted code gives it.

Functions§

describe_local_at
v0.122 (editor-currency slice 1): a hover summary for the local binding / parameter under the cursor — let x: <ty> / param n: <ty>, rendered from the checker’s captured LocalBinding (its ty is already the surface type_ref form, matching inlay hints and signature help). None when the cursor is not on a local. Reuses the same target_at resolution as go-to-definition / references, so hover cannot disagree with them.
inline_value_sites
The bindings whose value to show at stopped: each local declared inside visible and still in scope where the debugger is paused, named as the emitter names it (bynk_check::emitted_names). A binding whose emitted name is not knowable from the source (a re-let) is left out rather than guessed, so a value is never shown against the wrong variable.
is_suite_file
Whether text is a suite file. A suite’s cases run inside a scaffold that destructures names of its own (the unit under test’s types and functions, assets, bindings, for all binders) in the same JS scope as the case body; deliberately over-approximate (a line merely starting suite counts), since the cost of a false positive is a missing inline value.
local_definition_at
The definition site of the local under the cursor, if any.
local_sites_at
All sites of the local under the cursor — its definition first, then every use that resolves to it (shadowing-safe). None when the cursor is not on a local.
local_token_sites
Every local-binding occurrence in the file — (span, is_definition) — for semantic-token colouring. A token is a definition if it sits on a binding’s def span, else a use if it resolves to a local in scope at that point.