Skip to main content

execute

Function execute 

Source
pub fn execute(
    registry: &CommandRegistry,
    document: &mut Document,
    buffer_id: BufferId,
    cursor: Position,
    invocation: CommandInvocation,
    cancel: &CancellationToken,
) -> GrammarResult<Effect>
Expand description

Execute a CommandInvocation against document, using registry to resolve motions / text-objects / operators.

cursor is the position the modal engine considers “current” – typically the primary selection’s head.

cancel is the cooperative cancellation handle (DESIGN.md §5.2.5). Hot loops inside evaluators poll cancel.check()? between iterations; on a flipped token the dispatcher returns CommandError::Cancelled and commits no Effect. Callers that don’t drive cancellation (tests, scripts) pass CancellationToken::never.