Skip to main content

Module documentation

Module documentation 

Source
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 items with an exhaustive match on CommonsItem — the same shape bynk-lsp’s document_symbols walk uses — so a new declaration kind is a compile error here, in push_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 in crate::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. Returns None when the file has no recognisable unit header, or is a test suite (suite units are not a documentation unit in Tier 1 — their case/stub members have no describe_* renderer, and a doc page for tests is out of scope).