pub struct StashPickSource { /* private fields */ }Expand description
Pick a stash, then run the named magit ex-command on it.
The stash peer of CommitPickSource, and it exists for the same
reason: the stash chords resolve the stash under the cursor, and a
dispatch menu opened from an ordinary file has no cursor to read.
Before this the menu’s apply / pop / drop / show rows rendered,
fired, resolved nothing and returned — a visible row that did
nothing, silently, which is the failure BranchCheckoutSource’s
note calls out for <CR> in the branch buffer.
The pick is the stash’s index, not its message: git stash
addresses entries as stash@{N} and messages are neither unique
nor stable. The display carries the message because that is what a
person remembers, exactly as the commit picker shows the subject.
Implementations§
Trait Implementations§
Source§impl Default for StashPickSource
impl Default for StashPickSource
Source§impl PickerSourceGenerator for StashPickSource
impl PickerSourceGenerator for StashPickSource
Source§fn spec(&self) -> &PickerSourceSpec
fn spec(&self) -> &PickerSourceSpec
Generator metadata. Returned by reference so the
registry can stamp it into
: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>
Build the candidate set. Sync prelude: read what’s
needed from
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>
Translate the user’s chosen routing payload into a
typed
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.§fn accept_async(
&self,
_ctx: &PickerContext<'_>,
_routing: &RoutingPayload,
) -> Option<Pin<Box<dyn Future<Output = Result<PickerAcceptOutcome, String>> + Send>>>
fn accept_async( &self, _ctx: &PickerContext<'_>, _routing: &RoutingPayload, ) -> Option<Pin<Box<dyn Future<Output = Result<PickerAcceptOutcome, String>> + Send>>>
Async-accept hook. Default
None means “this source resolves accept
synchronously” — every native source takes this path and is unchanged. Read more§fn on_query_changed(
&self,
_ctx: &PickerContext<'_>,
_query: &str,
) -> Option<Result<PickerInitResult, String>>
fn on_query_changed( &self, _ctx: &PickerContext<'_>, _query: &str, ) -> Option<Result<PickerInitResult, String>>
Live-source hook: re-fetch candidates when the user’s
query changes. Default
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 more§fn descend(
&self,
_ctx: &PickerContext<'_>,
_candidate: &RawCandidate,
) -> Option<String>
fn descend( &self, _ctx: &PickerContext<'_>, _candidate: &RawCandidate, ) -> Option<String>
PC.10:
<C-l> — refine the query from the selected candidate instead
of accepting it. Read morePP.3:
<CR> on a row that is a SIGNPOST rather than a destination. Read more§fn initial_query(&self, _args: &[String]) -> Option<String>
fn initial_query(&self, _args: &[String]) -> Option<String>
PP.1: the query the picker opens WITH. Read more
§fn preview(
&self,
_ctx: &PickerContext<'_>,
_routing: &RoutingPayload,
) -> Option<PickerPreviewOutcome>
fn preview( &self, _ctx: &PickerContext<'_>, _routing: &RoutingPayload, ) -> Option<PickerPreviewOutcome>
T.12: live-preview hook — invoked as the picker SELECTION moves to
a candidate (before accept). Default None = no preview. A source
returns an outcome the host applies immediately for a live preview;
the host restores prior state on . Read more
§fn preview_debounce(&self) -> Option<Duration>
fn preview_debounce(&self) -> Option<Duration>
§fn owner_plugin(&self) -> Option<u64>
fn owner_plugin(&self) -> Option<u64>
PH.1: the host-issued id of the plugin that contributed this source,
None for a native one. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for StashPickSource
impl !UnwindSafe for StashPickSource
impl Freeze for StashPickSource
impl Send for StashPickSource
impl Sync for StashPickSource
impl Unpin for StashPickSource
impl UnsafeUnpin for StashPickSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more