Skip to main content

Module mode_action_handlers

Module mode_action_handlers 

Source
Expand description

SN.3c.0: boot-time registration of modes’ declarative global action handlers (Mode::action_handlers).

Sibling to crate::keymap_mode_contributions::translate_mode_keymaps: both walk the mode registry once at boot to apply a declarative Mode contribution. This one resolves each contribution’s action_name to a CommandId and registers the handler in the shared ActionHandlerRegistry, returning the RAII tokens. The host holds them for the app’s lifetime — the correct scope for buffer-agnostic handlers that read the active buffer/cursor/services from the ActionContext at call time (see feedback_effect_vocabulary_is_host_boundary). Per-buffer, session-scoped handlers register in Mode::on_activate instead, so their tokens drop with the Guard.

Functions§

register_mode_action_handlers
Walk every registered mode’s action_handlers(), resolve each contribution’s action_name → CommandId, register the handler globally, and return the registration tokens (held by the caller for the app’s lifetime).