pub struct CommandsSource {
pub spec: PickerSourceSpec,
pub registry: CommandRegistryHandle,
pub reverse: Arc<dyn KeymapReverseLookup>,
}Expand description
:picker commands. Walks the App’s CommandRegistry
and emits one row per registered ex-command (motions,
operators, etc. are not user-invocable through this
surface and stay out). Captures an Arc<CommandRegistry>
at construction time – the registry doesn’t live on
PickerContext because it’s static App-wide state, not
per-invocation snapshot data.
Fields§
§spec: PickerSourceSpec§registry: CommandRegistryHandleB3b: the ArcSwap handle (not a boot snapshot) so the palette
enumerates commands a plugin registered at runtime — init
.load()s it per open, mirroring the reverse cache below.
reverse: Arc<dyn KeymapReverseLookup>MP.2b: name → first-bound-chord reverse lookup. Captured
at construction like registry (both are static
App-wide facades, not per-open snapshot state — see the
PickerContext module doc on why feature facades live
here, not on the context). Each call reads the keymap’s
live ArcSwap reverse cache, so a :map / :unmap
between picker opens is reflected without rebuilding the
source.
Implementations§
Trait Implementations§
Source§impl PickerSourceGenerator for CommandsSource
impl PickerSourceGenerator for CommandsSource
Source§fn spec(&self) -> &PickerSourceSpec
fn spec(&self) -> &PickerSourceSpec
:describe-picker /
:picker <Tab> listings without cloning.Source§fn init(
&self,
ctx: &PickerContext<'_>,
_args: &[String],
) -> SourceResult<PickerInitResult>
fn init( &self, ctx: &PickerContext<'_>, _args: &[String], ) -> SourceResult<PickerInitResult>
ctx, clone into async captures if
necessary, return the appropriate PickerInitResult
variant. Synchronous errors (no active buffer when
one was required, args validation failure) return
Err; the host echoes the error and leaves the
picker closed. Read moreSource§fn accept(
&self,
_ctx: &PickerContext<'_>,
routing: &RoutingPayload,
) -> SourceResult<PickerAcceptOutcome>
fn accept( &self, _ctx: &PickerContext<'_>, routing: &RoutingPayload, ) -> SourceResult<PickerAcceptOutcome>
PickerAcceptOutcome the host applies. The
generator owns the mapping from its emitted
routing-payload variant(s) to outcome(s); mismatch
returns Err, which the host echoes.Source§fn accept_async(
&self,
_ctx: &PickerContext<'_>,
_routing: &RoutingPayload,
) -> Option<AcceptFuture>
fn accept_async( &self, _ctx: &PickerContext<'_>, _routing: &RoutingPayload, ) -> Option<AcceptFuture>
None means “this source resolves accept
synchronously” — every native source takes this path and is unchanged. Read moreSource§fn on_query_changed(
&self,
_ctx: &PickerContext<'_>,
_query: &str,
) -> Option<SourceResult<PickerInitResult>>
fn on_query_changed( &self, _ctx: &PickerContext<'_>, _query: &str, ) -> Option<SourceResult<PickerInitResult>>
None means “static source –
host uses fuzzy refilter over the candidate set
returned by init”. Returning Some(result) from a
source whose spec().live == true replaces the
picker’s candidate set wholesale; the host wires up
debouncing and cancels any in-flight invocation when a
fresh query arrives. Read moreSource§fn descend(
&self,
_ctx: &PickerContext<'_>,
_candidate: &RawCandidate,
) -> Option<String>
fn descend( &self, _ctx: &PickerContext<'_>, _candidate: &RawCandidate, ) -> Option<String>
<C-l> — refine the query from the selected candidate instead
of accepting it. Read more<CR> on a row that is a SIGNPOST rather than a destination. Read more