Expand description
Symbol lookups for hover and go-to-definition.
Single-file lookups walk the parsed AST. Cross-file lookups (v1.1; LSP
spec §3.4 cross-file requirement) iterate the project’s .bynk sources
to find a declaration in any unit the user might be referencing — used
when the open file lacks the symbol the user clicked on (typically
because the name was imported via uses or made available via
consumes).
Structs§
- Cross
File Symbol - A cross-file declaration lookup result: the path of the file containing the declaration, the declaration’s source span, and the full source text of that file (returned because callers need it to convert the span to an LSP range and to build hover content).
- DocLink
Candidate - #848: one intra-doc-link candidate scanned from doc-comment text — a
[Name]shortcut, a[`Name`]code-span-wrapped shortcut, or a[text][Name]full reference.spanis the byte range (into the text the scanner was given) of the whole construct to rewrite whennameresolves;displayis the link text to keep (Namefor a shortcut, the code span including backticks for the code-span form,textfor a full reference). - DocLink
Completion Context - #2458: where a doc comment’s cursor sits inside an unfinished
[…link. - DocLink
Span - #2454: one intra-doc-link candidate with the declaration its doc comment
is attached to.
attachedis the byte offset of that declaration’s name (the first identifier after the doc comment) — the key a resolver matches against an index definition site — orNonewhen no identifier follows. - Snapshot
Site - #2842: one
expect … matches snapshot "<name>"claim of a suite: the case it is in, its name, the claim’smatches snapshot "<name>"span, and the spans of the two contextual words.
Constants§
- ENV_
KEYWORD_ DOC - #2134: the contextual
envword’s one-line doc, shown when hovering it. - RESERVED_
PRINCIPALS - #706, #2135, #2864: the reserved call-site principals of a test case — each with
what the
systemdriver sends for it. Not declarations:by <name>names one of these, never an actor. - RUN_
ID_ DOC - #2138: the doc
run.idshows on hover and in completion.
Functions§
- constraint_
token_ spans - Constrained generics slice 0: the span of every constraint name in a bound
— a type parameter’s (
T: Eqon afn,typeor capability operation) and a method’swhere A: Eqentries — so the editor can classify them asinterfacetokens. - describe_
advance_ at - #2137 (ADR 0156): hover for the contextual
advancekeyword of anadvance Clock by <Duration>statement.Noneanywhere else, so an ordinary identifier namedadvancekeeps its own hover. - describe_
agent_ state_ at - v0.137.0 (ADR 0161): hover for the
key/storecontextual keywords and the agent state fields they introduce. Both are lexed asIdents (not reservedKEYWORDS), and the fields they declare are neitherlet/param locals nor top-level declarations — so neither the keyword fallback nor thedescribe_symbol/locals paths in the hover handler reach them. This closes that gap: for the cursor on thekey/storekeyword or on the field name it declares, render the field’s signature (type, and astorefield’s@indexed/@bounded/… annotations) followed by the contextual-keyword doc. - describe_
by_ at - #3191 (ADR 0161): hover for the contextual
bywhere it is a clause word — a handler’s or service header’s actor clause, a call’s actor clause, or thebyofadvance Clock by <Duration>.Nonewherebyis an ordinary name (a parameter, a binding, a field), which keeps that name’s own hover. - describe_
constraint_ at - Constrained generics slice 1: hover for a constraint name in a bound
(
T: Ord,where A: Eq) or aderivesclause.Nonefor any other identifier, so a type that happens to be namedOrdkeeps its own hover. - describe_
derives_ at - Constrained generics slice 1 (ADR 0156): hover for the contextual
deriveskeyword of a type declaration’sderives Ordclause.Noneanywhere else, so an ordinary identifier namedderiveskeeps its own hover. - describe_
effect_ method_ at - #2683, #2711, #3437: hover on the
withinofe.within(d), theraceofa.race(b)or thedetachofe.detach(), where the receiver is anEffect: its signature and what it does and does not do. The kernel methods have no declaration to read a doc from, so these are written here; the receiver’s type keeps a user type’s ownwithinorracemethod from being described as them. - describe_
env_ at - #2134: hover for a suite’s or case’s
env { … }clause — on theenvword, its doc (ENV_KEYWORD_DOC); on an entry’s name, the entry and where it applies: “variable given to every participant (suite)”, or “(case, overrides suite)” for a case entry its suite also gives.envis lexed as an identifier, so neither the keyword fallback nor the declaration rungs reach it.Nonewhen the cursor is on neither. - describe_
firstparty_ symbol - Describe a symbol declared in the embedded first-party sources — the
bynkandbynk.cloudflareadapters and thebynk.list/bynk.map/bynk.stringstdlib. Hover and completion-doc resolution otherwise walk only the project’s files (walk_bynk_files), so stdlib/surface symbols had no surfaced signature or doc; this is the fallback after the project scan. Any---doc block on a first-party declaration rides along (viadescribe_fn/describe_type/…), once the sources carry one. - describe_
fixture_ at - #2841: a hover for the contextual
fixturekeyword under the cursor: an identifier spelledfixturefollowed by a name and=, the one position a suite body reads it as a declaration.Noneanywhere else. - describe_
handler_ annotation_ at - v0.140 (ADR 0163): hover for a handler-position annotation (
@cache). Handler annotations are not symbols and declare no local, so they miss both thedescribe_symboland locals paths — this closes the gap. For the cursor anywhere within a handler’s@cache( … )annotation, render the formatted annotation followed by a prose description of@cacheand its fields.Nonewhen the cursor is not inside a handler annotation. - describe_
keyword_ at - v0.121 (ADR 0156): the reserved-keyword doc for the token at
offsetinsource, if the cursor sits on one — matched by source text againstbynk_syntax::keywords::KEYWORDS, independent of the token’sTokenKind(unlike the identifier-only lexical hover fallback above). This is hover’s floor for the mechanical coverage test: every lowercase-initial keyword gets at least this, even wheredescribe_symbolhas no richer path for it (e.g. the testing-track clause keywords —requires/ensures/suite/…). - describe_
par_ at - #2640 (ADR 0156): hover for the contextual
parkeyword of apar { … }binding block.Noneanywhere else, so an ordinary identifier namedparkeeps its own hover. - describe_
private_ at - #2618: a hover for the contextual
privatemodifier under the cursor: an identifier spelledprivateimmediately before afn,type,messages,asset,embedorconstkeyword, the one position the parser reads it as the modifier.Noneanywhere else, whereprivateis an ordinary name. - describe_
question_ at - #2839: hover on the
?of anOptionvalue. AnOptionis only liftable by?inside a handler returningHttpResult(ADR 0177), so anOptionoperand meansNoneanswers404 NotFound: the hover says so, and points atlet … elsefor any other status. A?on aResultis not described. - describe_
refinement_ example_ at - #2686: hover for an
@exampleafter a type declaration’s or record field’s refinement: the example and the refinement it has to satisfy.Noneelsewhere. - describe_
reserved_ principal_ at - #2135: hover for a reserved principal (
Nobody,Forged,Stale,Expired,WrongIssuer,WrongAudience,WrongAlgorithm,NoSubject) in a call-sitebyclause: what the driver sends.Nonewhen the cursor is not on one of those names right afterby. - describe_
run_ id_ at - #2138 (ADR 0156): hover for
run.idin acasebody — on either therunor theid.Noneanywhere else, and where the case binds its ownrun, so an ordinary value keeps its own hover. - describe_
self_ at - v0.122 (editor-currency slice 1): a hover summary for
selfunder the cursor —self: <Type>.selfis a reserved keyword (never anIdent, so it does not flow throughlocals_nav), but aselfuse is a typed expression, so its type is inexpr_typesat the token’s span. For a method the type is the receiver’s name; for an agent handler the checker givesselfa synthetic record type__<Agent>Self(to resolveself.<key>), which is un-synthesised here to<Agent>.Nonewhen the cursor is not on theselfkeyword or its type is unknown (noexpr_typesentry for it — on a broken buffer ADR 0094’s partial types usually still carry one; when they don’t, this degrades to the keyword doc). - describe_
snapshot_ at - #2842 (ADR 0156): hover for a snapshot claim: the snapshot the file under
snapshots/holds for it, or that none is recorded yet.storedis that file’s text (Nonewhen it does not exist).Noneaway from a claim. - describe_
store_ op_ at - #611: hover for a
storefield’s operation — the<op>of a<field>.<op>(…)call on an agent’sstorefield (items.put(id, item)). Store operations are checked but never indexed and are not value-receiver methods, soqualified_callee_at(name-receivers only) never reaches them and they resolved nowhere. Renders the operation’s signature from the enumerablebynk_check::store_opsregistry — generic in the kind’s key/value/element type — over the field’s declared kind, which grounds it. - describe_
symbol - Build a Markdown summary of a named declaration suitable for an LSP
hover response. Returns
Noneif no declaration matches. - describe_
symbol_ cross_ file - Markdown hover content for
namefrom any project file other thancurrent_path, plus the path of the file that contributed it. Seefind_declaration_cross_file’s doc for the content-ownership-track shape offiles. ReturnsNoneif the name is not declared anywhere in the project. - describe_
system_ job_ address_ at - #2136 (ADR 0156): hover for the
schedule/messageaddress name in asystem-tier case (sweeper.schedule(…),deliveries.message(m)), which runs the handler through the participant Worker’s ownscheduled/queueentry point rather than in process.Noneanywhere else, including the same address atunitorintegration, and a.schedule/.messagewhose receiver is not acron/queueservice of the suite’s target (a record field namedmessage, say). The target’s declaration is looked up insourceandothers(the project’s other files). - describe_
unit - #1885: hover Markdown for the unit
name— a fenced<kind> <name>line, followed by its module doc when one of its files carries one. - describe_
unit_ at - #1885: the module-doc hover for the unit name under
offsetintext(seeunit_name_at), resolved againsttextitself, thenothers(the project’s other files), then the embedded first-party sources (soconsumes bynk.cloudflarestill names its unit).Nonewhen the cursor is not on a unit name, or no source declares it. - describe_
variant_ key - #1888: the hover for a sum variant named by a qualified key,
"Shape.Circle", declared insource;Nonewhen no sum there has it. - describe_
variant_ named - #1888: the hover for a sum variant named bare, as a pattern or a
constructor names it (
Circle(r)), when exactly one sum insourcedeclares a variant of that name;Noneotherwise, so an ambiguous name answers nothing rather than the wrong variant. - doc_
link_ context - #2458: the doc-link completion context at
offset, orNonewhen the cursor is not inside a---/--|doc comment (or is in a fenced code block, or after a[already closed or broken by a non-identifier character). This is the strict gate for the server-wide[trigger: code outside doc ranges never yields a context. Tokenizes only;Noneif the source does not tokenize. - doc_
link_ spans - #848: the
(candidate name, absolute source span)of every intra-doc-link candidate inside everyDocBlocktoken insource— the clickable ranges for doc-comment document links, mirroringunit_reference_spans’s role foruses/consumestargets. Spans are computed against the raw, unstripped doc-block body (bynk_syntax::lexer::doc_block_body_range), not the common-indent-strippeddoc_block_contenttext — that stripping is not offset-preserving, so a span-based caller must avoid it. Only tokenizes (not a full parse), so links still surface even when the rest of the file has a parse error elsewhere, as long as tokenization succeeds. - doc_
link_ spans_ attached - #2454:
doc_link_spansplus the declaration each doc block precedes. - doc_
link_ unit - #2454: the unit whose scope a file’s doc links resolve in — its own
declared name, or a suite’s target unit (a suite declares no unit of
its own, so
own_declaration_nameisNonefor it). - find_
declaration_ cross_ file - Find
name’s declaration in any project file other thancurrent_path. Content-ownership track (#1086) slice 1:filesis a pre-read(path, content)map (the caller’s overlay-then-disk sweep) rather than bare paths this function used to read from disk itself. Returns the first hit, in path-sorted order (seesorted_paths);Noneif the name is not found anywhere in the project. - find_
declaration_ span - Return the source span of the declaration named
namein the given source text. ReturnsNoneif no declaration matches. - firstparty_
notes - Standard-library S3 (#1963): what hover adds about a first-party item’s
stability: that it is experimental (no compatibility promise, and an
[unstable] allowto use), and that an enum is extensible (amatchon it needs a wildcard). Empty for a stable, closed item. - handler_
annotation_ token_ spans - v0.140 (ADR 0163): the spans to classify as
decoratorsemantic tokens — each handler annotation’s@name(the@through the name) and its argument labels (maxAge:,scope:). Parsed fromsource; empty when it carries no handler annotations. Feeds the semantic-tokens producer, which is otherwise a parse-free index read, so the parse lives here beside the hover parse. - is_
test_ run_ receiver - #2138: whether the
runidentifier starting atrun_startinsourceis the test run’srun— inside a suite’scasebody, with no binder of its own in scope there. #2175: the scope is the checker’s: aletearlier in any enclosing block, a lambda parameter, amatcharm’s pattern, or anis <pattern>test’s bindings all shadow it. #2181: anistest binds where the checker says it does (bynk_check::narrowing): in anif’sthenblock when the condition holds, in itselseblock when it fails (if !(v is Some(run)) { … } else { run.id }), and on the right of&&andimplies(v is Some(run) && run.id == "x"). - keyword_
name_ token_ spans - #2837: the span of every reserved word written as a name, with whether it
names a method (called, or declared with
fn T.name() rather than a field. A keyword admitted as a label ({ type: String }) or as a member on the.’s line (a.type,Sorted.from(xs)) is lexed as a keyword, so a client that colours by spelling shows it as one; apropertyormethodtoken says what it is. The index already tokens a field’s declaration and uses; the caller keeps the index’s token where both have one. - own_
declaration_ name - #302: the source’s own declared qualified name and its span — the
rewrite target when the file backing this unit is renamed.
Nonefor asuite(itsSourceUnit::name()is its target’s name, not one of its own; nothing else addresses a suite by name) or on a parse bail. - private_
modifier_ token_ spans - #2618: the span of every
privatemodifier on the unit’s declarations (and, #2841, every suitefixturekeyword), for thekeywordsemantic token.privateis contextual, so an editor grammar that matches keywords by spelling cannot tell the modifier from a binding namedprivate; the parse can. - qualified_
callee_ at - v0.123 (editor-currency slice 2, DECISION B): if the identifier at
ident_spanis the member of anUpper.membername-receiver access (Clock.now,Email.of), return the fullRecv.membercallee forcrate::signature_help::resolve_labelto resolve to its signature — the same resolution completion and signature help perform, no new index.Nonefor a bare identifier or a lowercase (value-receiver) method, whichresolve_labeldoes not handle. - scan_
doc_ link_ candidates - #848: every intra-doc-link candidate in
text, in order.[text](url), an author-defined[label]: urlreference, fenced-code-block content, and non-identifier bracket content ([note]) are excluded — seescan_bracket_candidateanddoc_link_prepass(private below). - snapshot_
file_ for - #2842: the project-relative file (
snapshots/….snap.json) that holds the snapshots of the suite file atrel. - snapshot_
keyword_ spans - #2842: the contextual
matchesandsnapshotof every snapshot claim, for thekeywordsemantic token (an editor grammar that matches by spelling cannot tell them from a binding of the same name). - snapshot_
sites - Every snapshot claim in a suite’s cases, in source order. Empty for any other unit, and for a source that does not parse.
- store_
field_ kind_ at - #596: the storage-kind vocabulary a bare receiver is eligible for at
completion’s
<recv>.position —recv_endis the offset just past the receiver identifier (where its dot sat beforecompletion::value_receiver_rewritedropped it, sosourcehere is that rewritten buffer). Mirrorsdescribe_store_op_at’s by-provenance receiver check (not shadowed by a local, inside the declaring agent’s state scope), but starts from the receiver’s own end offset rather than walking back from an operation token, since completion fires before any member name is typed — and the rewrite’s postcondition already guarantees a bare, non-dot-qualified name reaches here, so unlikedescribe_store_op_atthere is no furtheris_dot_precededcheck to make. - type_
ref_ str - unit_
name_ at - #1885: the qualified unit name under
offset, when the cursor sits on the file’s own unit-header name or on auses/consumes(or a suite’s) target path — the positions where hover shows a unit’s module doc. - unit_
reference_ spans - Slice 6b: the
(unit name, name span)of everyuses/consumestarget in the source — the clickable ranges for document links. The link’s target file is resolved by the handler through the unit→source map (ADR 0095); this only finds the spans, so it works on the live buffer regardless of the map.