Skip to main content

Module transient

Module transient 

Source
Expand description

Transient mode — grouped action menus within the picker.

A transient presents groups of action items with single-key selection, toggleable flags, argument inputs, and a live command preview. Magit is the first consumer (dispatch menus, branch menus, stash menus), but which-key key hints, command palette drilldown, and future plugin transients all reuse the same mechanism.

See docs/dev/architecture/magit.md §8.

Structs§

TransientArgSource
MG.53.e: where a picker-backed TransientItemKind::Argument gets its candidate list.
TransientContext
Registry of named transient builders, populated at boot by each owning mode crate (magit registers magit-dispatch / magit-file-dispatch; per the module doc, which-key / command palette / future plugin transients are meant to reuse the same mechanism). Effect::OpenTransient { source } carries only the name — resolving it to an actual TransientSpec (which can’t cross into lattice-grammar’s Effect enum directly, since TransientSpec lives downstream of it) happens here, at the renderer’s effect-handling site. Mirrors PickerRegistry’s named-source shape, simplified: transients have no candidate generator or arg-schema concept, just a name and a builder.
TransientGroup
A named group of transient items.
TransientItem
A single entry in a transient group.
TransientSourceRegistry
TransientSpec
Specification for a transient menu — the complete layout. Stored behind an Arc in the Picker struct so clone is a ref-count bump; the preview boxed closure stays alive across clones.

Enums§

KeyResolution
What TransientSpec::resolve_key made of the keys typed so far.
TransientBuild
What TransientSourceRegistry::build answers with.
TransientItemKind
The kind of a transient item — determines its interaction.
TransientValue
A single value in the transient state (flag or argument).

Functions§

confirm_transient_spec
Build a simple y/n confirmation transient spec. prompt is the title shown at the top; yes_command_id is the action fired when the user presses y.
transient_initial_state
Build initial state from a spec — flags get their defaults, arguments get their defaults (or empty string).

Type Aliases§

TransientBuildFuture
A menu build that could not answer synchronously — the shape a guest-backed builder returns. Mirrors PickerInitResult::Future: 'static + Send, so the host can move it onto its own runtime and seat the menu when it lands.
TransientSourceRegistryHandle
Service handle registered via SubsystemBoot::register_service — same Arc<X> register-and-lookup convention every other service handle in this codebase uses.
TransientState
Accumulated state for an open transient: flag values and argument values. Keyed by the name field from TransientItemKind::Flag and TransientItemKind::Argument items.