Skip to main content

Module decoration_source

Module decoration_source 

Source
Expand description

The async gutter-decoration producer seam (PL8.E).

Mode::gutter_decorations (see crate::contributions) is the sync, read-per-frame decoration trait native modes (diff, LSP severity) satisfy inline. A WASM plugin can NOT satisfy it that way — running the guest per frame from the renderer would violate paramount goal #1 (no UI-thread WASM).

Instead a plugin decoration provider is an AsyncGutterDecorationSource: the host polls it OFF the render path on a trigger (edit / scroll / producer (de)registration), caches the returned Vec<GutterDecoration> per buffer, and the renderer reads only that native cache — never the producer.

The trait + registry live here (not in lattice-plugin-host) so the substrate-neutral lattice-mode and the renderers (which read only the cached GutterDecorations) stay free of any wasmtime dependency. The single implementor today is the plugin host’s WasmDecorationSource; the indirection mirrors AsyncCompletionSource (lattice-completion) and PickerSourceGenerator (lattice-picker) — a generic native trait a WASM source implements, so the loader hands a trait object across the seam.

Structs§

DecorationEpoch
The counter a guest bumps to say “my decorations changed, though the document did not” (OA.30).
GutterDecorationSourceRegistry
Runtime-mutable registry of AsyncGutterDecorationSources.

Traits§

AsyncGutterDecorationSource
An async, off-render-path producer of a buffer’s gutter decorations.

Type Aliases§

DecorationEpochHandle
Register and look up with this exact alias (the ServiceRegistry TypeId rule).
DecorationFuture
The boxed future an AsyncGutterDecorationSource::produce returns.
GutterDecorationSourceRegistryHandle
Boot-service handle: Arc<ArcSwap<…>> so the loader RCU-registers producers at runtime while the host reads wait-free. Register and look up with this exact alias (the ServiceRegistry TypeId rule).