pub struct RefPickSource { /* private fields */ }Expand description
MG.53.d/e: the tag, remote and ref pickers.
Three ids, one implementation, because they differ only in what they
list. Reference::list already returns branches, remotes and tags
in one for-each-ref walk tagged with a [RefKind], so a tag
picker is that walk filtered — building a separate git tag call
beside it would be a second way to ask the same question.
Parameterised by the ex-command that receives the pick, exactly as
BranchPickSource and CommitPickSource are, and for the same
reason: a picked candidate reaches an operation only as an ex line.
Implementations§
Trait Implementations§
Source§impl PickerSourceGenerator for RefPickSource
impl PickerSourceGenerator for RefPickSource
Source§fn preview(
&self,
ctx: &PickerContext<'_>,
routing: &RoutingPayload,
) -> Option<PickerPreviewOutcome>
fn preview( &self, ctx: &PickerContext<'_>, routing: &RoutingPayload, ) -> Option<PickerPreviewOutcome>
MG.54: C-c f v used to show nothing until you accepted, so
choosing between two revisions meant accepting one, looking,
going back, and accepting the other. This answers the question
the picker is asking.
Synchronous git show, which is only sound because the host does
not call this while the selection is moving — see
Self::preview_debounce. The blob fetch itself is guarded
(size, binary, line count) by preview_blob.
The preview buffer takes the name magit-find-file would give
the real one, so what the pane says while you are choosing is
what the buffer is called once you accept.
Source§fn preview_debounce(&self) -> Option<Duration>
fn preview_debounce(&self) -> Option<Duration>
MG.54: never while the user is still moving.
git show on every arrow key would be a subprocess per keystroke
on the actor thread. Declaring the window means a scroll through
fifty revisions spawns nothing at all, and the one fetch that
does run is for the revision the user stopped on — so there is
nothing to cancel and no stale result to discard.
None when the feature is off, so a user who turns it off pays
for no timers either. The other scopes never previewed.
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.§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>>>
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>>
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>
<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§fn initial_query(&self, _args: &[String]) -> Option<String>
fn initial_query(&self, _args: &[String]) -> Option<String>
§fn owner_plugin(&self) -> Option<u64>
fn owner_plugin(&self) -> Option<u64>
None for a native one. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RefPickSource
impl !UnwindSafe for RefPickSource
impl Freeze for RefPickSource
impl Send for RefPickSource
impl Sync for RefPickSource
impl Unpin for RefPickSource
impl UnsafeUnpin for RefPickSource
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
§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> ⓘ
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> ⓘ
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