Skip to main content

Module wasm_decorations

Module wasm_decorations 

Source
Expand description

PL8.E — WASM gutter decorations: producer → per-buffer cache → renderer.

The one hot-path-sensitive plugin seam. A decoration plugin’s producer runs OFF the render path (paramount goal #1); the renderer reads only a native per-buffer cache. This module owns:

  • WasmGutterDecorationCache — the per-buffer cache value (the merged marks + the document version they were produced against).
  • WasmDecorationState — the cohesive bundle of decoration wiring the Editor holds (one field, so the boot struct literal grows by one line): the cache, the producer registry handle, the off-keystroke paint generation, and the single-flight / registry-epoch bookkeeping.
  • Editor::maybe_refresh_wasm_decorations — the per-tick refresh pump, modelled on maybe_request_inlay_hint: version/registry-gated, single-flight, spawns producers off the actor thread, writes the cache via insert_for, bumps the paint generation, and wakes the render pipeline.

The producer trait + registry themselves live in lattice-mode (AsyncGutterDecorationSource) so this crate — and the renderers reading the cache — never depend on lattice-plugin-host. The loader (drain_decorations) registers the WASM producer into the registry service; the host reads it here.

Slice plan: docs/dev/operations/slice-plans/plugin-loader.md (PL8.E).

Structs§

WasmDecorationState
The Editor’s cohesive WASM-decoration wiring (PL8.E). Bundled into one field so the boot struct literal grows by a single line and the state stays together. Every field defaults (empty cache / no registry / generation 0), so Editor::default() test fixtures get an inert decoration seam.
WasmGutterDecorationCache
Per-buffer cache of a decoration plugin’s gutter marks.