Expand description
v0.25 (ADR 0053): pure queries over the project binding index.
Everything here is a pure function over ProjectIndex + analysed
snapshot texts — the unit-testable core behind textDocument/references
and rename/prepareRename. Transport-side handlers in main.rs only
convert positions and package results.
Rename is validated two ways, both correct-by-construction:
- Collisions — apply the edits to an overlay, re-run
diagnose_project, refuse if a new diagnostic appears (no_new_diagnostics). - Capture/escape — re-analysis alone misses silent re-binding
(declared fns shadow fn-typed locals in call position), so the
re-built index must equal the pre-index modulo the rename
(
index_unchanged_modulo_rename).
Structs§
- Call
Relation - v0.34 (ADR 0067): one end of a call-hierarchy relation — the related
symbol (
key+ its definition site) and the call sites linking it to the queried symbol. For incoming callskeyis a caller andsitesare where it calls the queried symbol; for outgoing,keyis a callee andsitesare where the queried symbol calls it. The sites double as the LSPfromRanges(identical for both directions). - DocLink
Context - #2454: the declaration a doc comment is attached to, as far as link
resolution needs it:
attachedis the byte offset of its name inpath(bynk_ide::symbols::DocLinkSpan::attached), andlocalsthat file’s local bindings, from which a fn / handler / op’s parameters are read, andtextthat file’s analysed source, which bounds the parameter list. - DocLink
Mention - #2456: one doc-link mention in a source file that resolves to a definition
(see
doc_link_mentions). - DocLink
Suggestion - #2458: one name a doc link could be completed to.
- Rename
Plan - A planned rename: every name-segment edit, grouped per file, spans ascending. The definition site is edited along with every reference.
- Resolved
DocLink - #2454: a resolved doc link — the definition site, and its index key when it has one (a parameter is a local binding, not an indexed symbol).
Enums§
- DocLink
Resolution - #2531: the outcome of
resolve_doc_link_in. - Hierarchy
Target - What
prepareTypeHierarchyresolved the cursor to.
Constants§
- DOC_
LINK_ BARE_ KINDS - #848: the top-level kinds a bare doc-link name matches.
- DOC_
LINK_ MEMBER_ KINDS - #848: the flat compound-name member kinds (
"Owner.member", built bybynk-emit’sassemble_index). A dotted doc-link name matches these verbatim — never split into owner/member.
Functions§
- add_
doc_ link_ edits - #2456: extend
planwith the doc links that resolved to the renamed symbol before the rename, across every file insnapshots. A link to the symbol itself has its last segment rewritten ([Limiter],[Limiter.decide]whendecideis renamed); when a type-like symbol is renamed, a link to one of its members has its owner segment rewritten ([Limiter.decide]whenLimiteris). Display text and backticks are untouched, and a link that resolves to some other definition of the same name is left alone. - apply_
edits - Apply one file’s edits (spans ascending) to its snapshot text.
- capability_
provider_ lenses - v0.127 (editor-currency slice 6): a provider-count lens per
capabilitydefinition inpath, as(capability def, provider def sites). The count isproviders.len(); the provider sites feed the sameshowReferencespeek the reference lens uses. Reuses theimplementationsrelation (theimpls_ofedge behind go-to-implementation), so a capability with no provider yields no lens. Sorted by definition position, alongside the reference lenses. - code_
lenses - v0.33 (ADR 0066):
codeLens— one reference-count lens per top-level definition inpath, as(def site, reference sites). The count isrefs.len(); the reference sites feed theshowReferencesaction. Sorted by definition position (a stable, top-to-bottom lens order). - definition_
at - The definition site for the symbol at the cursor (an index-backed, binding-correct go-to-definition).
- doc_
link_ mentions - #2456: every doc-link mention in
snapshotsthat resolves (throughresolve_doc_link_in, with the declaration each comment is attached to as context, so a bare[field]in its own record’s doc counts) to the definition attarget.localsis the round’s per-file local bindings. - doc_
link_ mentions_ of doc_link_mentionsover several definitions at once: a mention is kept when it resolves to any oftargets. Rename uses it to also catch[Type.member]links when the owning type is renamed.- doc_
link_ owner_ declared - #2455: whether any unit in
owner_unit’s doc-link scope declares a top-level symbol namedowner(the part of a doc-link name before any.). A project declaration shadows a first-party name of the same spelling, so the first-party fallback must not run when this is true — even ifresolve_doc_link_indeclined (ambiguous, or a member miss). - doc_
link_ suggestions - #2458: the names a doc link in
owner_unitcould resolve, in resolution order — the single place completion defines that order: - doc_
links_ rebound - #2456 (decision C): after a rename, every doc link must resolve to the same
definition it did before — modulo the rename itself.
post_*describe the re-analysed project with the edits applied,post_textsthe edited sources. A link that now resolves elsewhere, stops resolving, or starts resolving is a silent re-binding, reported like any other. - document_
highlights - v0.26 rider (ADR 0055):
documentHighlight— the symbol-at-cursor’s occurrences within that same file (thereferencesquery, file-scoped). The index does not distinguish read from write references, so the LSP layer omits the highlightkind. - implementations
- v0.35 (ADR 0068):
textDocument/implementation— the definition sites of every provider implementing the capabilitykey, sorted by definition position. Empty for a non-capability or unknown key (the request then falls through; goto-def still serves the reverse, provider → capability). - incoming_
calls - v0.34 (ADR 0067):
callHierarchy/incomingCalls— the callers ofkey, each with the call sites at which it callskey. - index_
unchanged_ modulo_ rename - Validator (2): the re-built index must equal the pre-index modulo the rename — every other symbol’s reference set identical (after remapping shifted spans), the renamed symbol’s sites exactly the edited ones. Catches silent re-binding (capture/escape) that produces no diagnostic.
- named_
type_ target - The user-declared type a value’s type points at, for go-to-type-definition:
a
Nameddirectly, or the element of a single-parameter container (Option/Effect/List/HttpResult) unwrapped to it. Built-in, function, actor, and two-parameter (Result/Map) types have no single type-declaration target and yieldNone. - no_
new_ diagnostics - Validator (1): refuse when the edited project carries a diagnostic the original did not — compared as per-(file, category) counts, robust to span shifts. Removals are tolerated; additions refuse.
- outgoing_
calls - v0.34 (ADR 0067):
callHierarchy/outgoingCalls— whatkeycalls, each with the call sites withinkeyat which the callee is called. - own_
part_ names - #2459: the names
resolve_doc_link_inresolves as the attached declaration’s own parts (member and parameter names, bare), for the did-you-mean candidates of the unresolved-link hint. Only names that resolve (a name defined as two member kinds is ambiguous, so never one). - plan_
rename - Build the rename plan for the symbol at the cursor. Errors are human-readable strings surfaced as LSP request failures.
- prepare_
call_ hierarchy - v0.34 (ADR 0067):
prepareCallHierarchy— the symbol under the cursor and its definition site (the goto-def resolution; an item is anchored on the definition).Nonefor out-of-scope positions. - prepare_
rename prepareRename: the renameable range under the cursor, orNonefor out-of-scope symbols (locals, unit names) — the request is refused rather than falling through to a partial rename.- prepare_
type_ hierarchy textDocument/prepareTypeHierarchy: the refined/opaque/alias type under the cursor, or the primitive named by the token under it (#2530) — a declaration’s base, a field or parameter type, anywhere it is written.textispath’s analysed snapshot.Nonefor any other position, including a record or sum, which has no base.- refinement_
family_ lenses - v0.129 (#259): a refinement-family lens per refined/opaque
Typedefinition inpath, as(type def, base, family def sites)— every refined/opaque type (and plain alias) declared over the same builtinbase, across the project. The family includes the type itself, so a lens is emitted only for a family of ≥ 2 (a lone refinement has nothing to navigate to — no lens, mirroringcapability_provider_lenses). Sorted by definition position, alongside the reference lenses. - remap_
site - The post-edit position of a pre-edit site — rename edits shift spans within edited files. An edited span maps to the new name’s span.
- resolve_
doc_ link_ in - #2454, #2531: the one doc-link resolver. A candidate resolves in order:
- sites_
for - Definition first, then references — the
referencessurface. - type_
definitions_ named - Slice 6:
textDocument/typeDefinition— the definition site(s) of the type namedname(aTypesymbol). The checker’sTy::Named.nameand the index both use bare names, so this is a bare-name match; a name shared across units yields several locations (the LSP-conventional resolution — the client lets the user choose). Sorted by definition position. - type_
subtypes typeHierarchy/subtypesof a primitive: every refined, opaque or alias type declared overbaseacross the project, sorted by definition position. Anopaquetype is listed only to requests from its declaring unit.- type_
supertype typeHierarchy/supertypesof a refined/opaque type: its builtin base and where the declaration writes it — the only supertype Bynk has (a base is always a primitive, never another declared type).Nonewhen the type has no base, or it isopaqueand the request does not come from the declaring unit.- unit_
of_ file - The unit a source file belongs to, read off the first index symbol defined
in it.
Nonefor a file that defines nothing. - validate_
new_ name - A new name must lex as exactly one identifier (keywords lex as their own token kinds, so they fail this check).
- workspace_
symbols - v0.26 rider (ADR 0055):
workspace/symbol— every index definition whose name contains the query, case-insensitive (an empty query lists all), sorted by (name, unit) for a stable order.