Expand description
The native seam for an async producer of structural context scopes (TC.2).
The tree-sitter-context analogue of AsyncGutterDecorationSource: the host
drives it OFF the render path on a trigger (a completed reparse), caches the
returned scopes per buffer, and every later read is native. The renderer
never touches a producer.
The trait lives here rather than in lattice-plugin-host for the reason the
decoration one does: lattice-mode and the renderers must stay free of any
wasmtime dependency, so the loader hands a trait object across the seam. The
single implementor today is the plugin host’s WasmContextSource.
Why scopes and not rows. A [ContextScope] is a pure function of the
parse tree — no viewport, no cursor, no options — so the host can cache the
set per parse version and answer “which apply to THIS pane right now” itself
with resolve_context. A producer
that returned finished rows would have to be re-driven on every scroll and
cursor move, which is a WASM call on the keystroke path (paramount #1) and a
cache that thrashes by construction.
Design anchor: docs/dev/architecture/treesitter-context.md.
Structs§
- Context
Source Registry - Runtime-mutable registry of
AsyncContextSources.
Traits§
- Async
Context Source - An async, off-render-path producer of a buffer’s structural context scopes.
Type Aliases§
- Context
Future - The boxed future an
AsyncContextSource::producereturns. - Context
Source Registry Handle - 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 (theServiceRegistryTypeId rule).