Skip to main content

Module boundary_decoration

Module boundary_decoration 

Source
Expand description

The decoration/ui boundary conversions (plugin-host.md §5 decorations/ui, PH7.9a).

Mirrors Mode::gutter_decorations + GutterDecoration (lattice-mode) — the per-line gutter data a plugin decoration provider produces. Two directions:

  • GutterDecoration crosses guest→host (the producer’s return): a WitBoundary round-trip (compiler-exhaustive both ways — a new arm can’t land without a mapping; the effect precedent). Per-line scalars only; no draw calls cross.
  • decoration-context crosses host→guest (one-way, the grammar project_* precedent). The native DecorationCtx is buffer_id + a ServiceRegistry of render-state snapshots (host-owned, can’t cross), and a plugin producer runs OFF the render path anyway — so the host builds the owned context from buffer metadata (id / path / line count) when it triggers the producer. Bulk buffer text rides host-services / the deferred document handle, not this record.

The ui emit surface had a modeline half here that was type-mirror-only, and OC.3 / ML.6 gave it a real producer — ui.wit plus ui_host, which builds native ModelineElement / ModelineElementUpdate values directly rather than round-tripping a record, so nothing here converts for it. The ui-segment record that used to be mirrored is gone with it: building the producer against a real consumer showed it conflated the descriptor’s zone with the content’s text (see the note in types.wit).

ui-notification is still mirror-only and still has no producer — a plugin notifies via effect.echo — so the smoke test below keeps sizing it for the freeze.

Functions§

decoration_from_wit
SG.3b — the registry-aware guest→host conversion, and the one the producer call site uses.
decoration_to_wit
SG.3b — the registry-aware host→guest conversion.
project_decoration_context
Build the owned decoration-context the host hands a producer (host→guest, one-way). The host has the buffer metadata off the render path when it triggers the producer; the guest computes per-line decorations from these scalars (+ host-services for external data like git HEAD). A non-UTF-8 path is dropped to None (a decoration producer keys off the buffer, not the path text — losing an un-representable path degrades gracefully rather than failing the whole trigger, unlike an event delivery).