Skip to main content

Module dispatcher

Module dispatcher 

Source
Expand description

The unified dispatcher (DESIGN.md §5.2.1).

execute is the single entry point through which every command flows: built-in operators / motions / text-objects, ex-commands parsed from :, plugin contributions, and palette selections. Vim’s grammar UX is preserved exactly via the keystroke parser (which assembles a CommandInvocation and calls execute); the simplification is that there is just one dispatcher below the parser.

Phase 1 implements operator-with-motion-target (the most common path), motion-alone, text-object-alone, and explicit grammar Range resolution. ExCommand and Action paths are wired – the latter via slice 8.i.0 (see docs/dev/notes/8i-approach.md); registry entries grow during slices 8.i.1-3 as the legacy Action bridge in lattice-ui-tui retires.

Functions§

execute
Execute a CommandInvocation against document, using registry to resolve motions / text-objects / operators.
execute_motion_only
Resolve a motion-only invocation against a bare [Buffer] + cursor, without a [Document] / undo stack / selections.
execute_motion_only_reporting
VM.3d-2: execute_motion_only, also reporting the motion’s notice.
execute_with_env
N.1.4a / N.1.6 (2026-06-10): execute plus the per-dispatch GrammarEnv — the tree-sitter scope_resolver (af/ac) and the comment_syntax (aC/iC). The host builds the env (N.1.4b / N.1.6) and threads it down to the TextObjectContext; the classic objects (iw, ap, i{) ignore it.
notice_text
VM.3d-2: what a motion’s notice says. One wording for both peers — the document path (an Effect::Echo beside the motion) and the read-only one (the host echoes it itself), which would otherwise drift.