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.

Functions§

ident_at 🔒
The identifier-token name covering offset, if any.
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.
target_at 🔒
The binding the cursor refers to — whether it sits on the definition name or on a use — within locals (a file’s bindings).