Expand description
#847: the documentation-model query — a file’s declarations aggregated into a rendered reference page (“live rustdoc for Bynk”), for the VS Code “Show Documentation” webview.
A pure, read-only IDE query. It does two things and reuses everything else:
-
Traversal. It walks the parsed unit’s
itemswith an exhaustive match onCommonsItem— the same shapebynk-lsp’sdocument_symbolswalk uses — so a new declaration kind is a compile error here, inpush_item, not a silently-missed row on the page. (Risk: “a new doc-bearing node kind is added and silently missed by the aggregator.”) -
Per-declaration rendering. Each entry’s Markdown (its fenced signature plus its doc-comment prose) is produced by hover’s own
describe_*assembly incrate::symbols— not a parallel renderer. Sharing that code path is what keeps the doc page from drifting from hover. (Risk: “divergence from hover — two code paths formatting the same doc differently.”)
What this module adds on top is the page structure: the declaration’s
heading name, its nesting depth (top-level item → its ops/handlers), a
documented flag driving the “no documentation” coverage placeholder, and
the name span each heading links back to (click-to-code). The Markdown is
rendered — HTML-disabled — by the webview; nothing here emits HTML.
Tier 1 (Decision A) is file-scoped: the model is built from one file’s
text, exactly like document_symbols. Context-aggregation (merging every
file of a multi-file context) is the deferred follow-up.
Structs§
- DocEntry
- One declaration on the page: a heading, its rendered signature+doc Markdown, and where it lives in the source.
- DocModel
- A file’s declarations rendered as an ordered, hierarchical reference page.
Functions§
- documentation_
model - Build the documentation model for a single file’s
text. ReturnsNonewhen the file has no recognisable unit header, or is a test suite (suiteunits are not a documentation unit in Tier 1 — theircase/stubmembers have nodescribe_*renderer, and a doc page for tests is out of scope).