Expand description
Re-exports bynk-ide’s symbol logic (#808) — moved there so it’s
reachable from bynk-wasm too, which can’t depend on this crate’s
tower-lsp/tokio stack. See bynk_ide::symbols for the real module.
The one exception is the cross-file lookup trio below: bynk-ide’s
versions are PathBuf-keyed (wasm has no Url), so this crate re-wraps
them in the Url shape the LSP handlers actually use. Rust’s shadowing
rule lets these locally-defined names win over the glob import.
Structs§
- Cross
File Symbol - A cross-file declaration lookup result: the URI 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).
Functions§
- 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_
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_
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_
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 (a broken buffer —expr_typesis clean-file-only, so this degrades to the keyword doc, never a wrong type). - 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_uri, plus the URI of the file that contributed it. Seebynk_ide::symbols::describe_symbol_cross_filefor the pure logic. - 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. - find_
declaration_ cross_ file - Find
name’s declaration in any project file other thancurrent_uri.filesis a pre-read(path, content)map (content-ownership track, #1086, slice 1) — seebynk_ide::symbols::find_declaration_cross_filefor the pure logic. - find_
declaration_ span - Return the source span of the declaration named
namein the given source text. ReturnsNoneif no declaration matches. - 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. - linkify_
doc_ links - #848: rewrite every resolvable intra-doc-link candidate in
content(hover Markdown — a ```bynk fenced signature, optionally followed by the declaration’s doc-comment prose) into a Markdown link, resolved againstowner_unit’s doc-link scope order (crate::index_queries::resolve_doc_link). The fenced signature block (and any author example fence) is never touched —scan_doc_link_candidatesskips fenced regions itself. An unresolved candidate is left exactly as authored — no diagnostic, matching the render-only decision. - 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. - 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). - 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_
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.