pub struct DispatchEnv {Show 18 fields
pub scope_resolver: Option<ScopeResolverHandle>,
pub comment_syntax: Option<Arc<CommentSyntax>>,
pub syntax: Option<Arc<dyn Any + Send + Sync>>,
pub indent: IndentUnit,
pub indent_resolver: Option<IndentResolverHandle>,
pub textwidth: WrapWidth,
pub native_format: NativeFormatIntents,
pub selection: Option<Range>,
pub last_find: Option<LastFind>,
pub fold_resolver: Option<FoldResolverHandle>,
pub last_search: Option<LastSearch>,
pub marks: Option<MarkResolverHandle>,
pub viewport: Option<ViewportResolverHandle>,
pub nostartofline: bool,
pub scrolloff: u32,
pub curswant: Option<Curswant>,
pub display: Option<DisplayResolverHandle>,
pub curswant_out: Option<Arc<Mutex<Option<Curswant>>>>,
}Expand description
N.1.6 (2026-06-10): the owned, thread-safe per-dispatch environment
for text objects, carried across the actor channel. Bundles the
inputs a text object’s apply may read — the tree-sitter
scope_resolver (af/ac, N.1.4) and the comment_syntax
(aC/iC, N.1.6) — so the dispatch seam threads ONE value instead
of a widening parameter list (the long-term-fit choice over parallel
params). The actor borrows these into a lattice_grammar::GrammarEnv
at the execute_with_env call. Default is the no-input case.
Fields§
§scope_resolver: Option<ScopeResolverHandle>§comment_syntax: Option<Arc<CommentSyntax>>§syntax: Option<Arc<dyn Any + Send + Sync>>OT.4: the buffer’s tree-sitter snapshot, type-erased so
lattice-runtime stays syntax-free (the plugin trampoline
downcasts it back to an Arc<SyntaxSnapshot>).
Distinct from scope_resolver rather than replacing it, and the
distinction is why this field had to exist. The resolver answers
“what scope encloses this point” for the NATIVE structural objects
and is deliberately erased to that one question — the concrete
snapshot cannot be recovered from it, so it cannot mint a plugin’s
tree-snapshot resource.
TS.1 left this out because grammar actions were the only
tree-snapshot consumer, and those dispatch through the host’s Action
gate rather than this channel. OT.1 made motions and text objects
consumers too, and they come through here — so without this field
org’s ar / ]] / g{ received none on every real keystroke
while every test that built a GrammarEnv by hand passed.
indent: IndentUnitIN.0: one level of indentation, resolved by the host from
shiftwidth / expandtab / tabstop. Read by > / <.
Default is the registered option defaults, so the actor path
indents like an unconfigured buffer rather than not at all.
indent_resolver: Option<IndentResolverHandle>IN.7: per-line indent depth for =. None means no
structural source, and = reindents nothing rather than
guessing.
textwidth: WrapWidthRF.2: the buffer’s textwidth, for the reflow operator. Carried
here for the reason syntax and selection had to be: gq
reaches the grammar through the ACTOR path on every real
keystroke, so a field missing here is a field the operator never
sees no matter how well the direct path is tested.
WrapWidth, not usize, so this struct keeps its derived
Default and still means 80 rather than 0.
native_format: NativeFormatIntentsRF.5b: which formatting intents this buffer handles natively.
Carried for the reason textwidth is: = and gq reach the
grammar through the ACTOR path on every real keystroke.
selection: Option<Range>OS.2: the active region — the Visual/Select selection extent, or None
outside Visual/Select.
Carried here for the reason syntax above had to be: an action reached
through the ACTOR path builds its ActionContext from this env, so a
hard None would make a plugin’s Visual action see no region on every
real keystroke while every test that hand-built a GrammarEnv passed.
That is the OT.4 failure verbatim, and it is cheaper to carry the field
than to rediscover it.
last_find: Option<LastFind>VM.3c: the last f / F / t / T, so ; and , can be motions.
Same reasoning as every field above it: ; is an ordinary motion on
the keystroke path, so it comes through the actor, so the state it
needs has to travel with the dispatch. None is the pre-first-f
state and makes ; a no-op, which is what vim does.
fold_resolver: Option<FoldResolverHandle>VM.3i: the fold edges zj / zk step between. Same reasoning as
last_find: they’re motions on the keystroke path, so they come
through the actor. None for a buffer with no folds.
last_search: Option<LastSearch>VM.3d-2: the last search, for n / N / * / #, which are motions
on the keystroke path and so come through the actor too.
marks: Option<MarkResolverHandle>VM.3e: the mark table, for 'x / `x, which come through the
actor like every keystroke motion. None when no mark is set.
viewport: Option<ViewportResolverHandle>VM.3f: the lines the window shows, for H / M / L. The host builds
it only when the invocation is one of them.
nostartofline: boolVM.3f: !startofline — H / M / L keep the cursor’s column.
scrolloff: u32VM.3f: scrolloff, the margin H / L stop short of the window’s
edges by. 0 puts them on the first and last lines shown.
curswant: Option<Curswant>VM.3g-1: vim’s curswant, the column j / k aim for across short
lines. Carried like every other keystroke input: j comes through the
actor on every press.
display: Option<DisplayResolverHandle>VM.3g-2: display geometry for gj / gk / g0 / g$, built only when
the invocation is one of them.
curswant_out: Option<Arc<Mutex<Option<Curswant>>>>VM.3g-3: where a motion reports the goal column it AIMED at, which for
gj / gk is not the column it reached — the display row it lands on
may be too short, and vim keeps the aim (measured: a clamped gj
landing at column 100 records curswant 160).
Owned rather than borrowed, unlike its GrammarEnv counterpart, and
that is forced rather than chosen: this struct crosses the Document
trait into a Pending<Effect>, so a borrow could not outlive the
future. The actor borrows it back out at the execute_with_env call,
which is the same shape every other field here already has.
None — the default — discards the report, which is right for every
caller that keeps no goal column.
Trait Implementations§
Source§impl Clone for DispatchEnv
impl Clone for DispatchEnv
Source§fn clone(&self) -> DispatchEnv
fn clone(&self) -> DispatchEnv
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more