pub struct GrepSource {
pub spec: PickerSourceSpec,
pub config: Arc<ConfigRegistry>,
pub highlighter: Option<Arc<dyn GrepPreviewHighlighter>>,
}Fields§
§spec: PickerSourceSpec§config: Arc<ConfigRegistry>§highlighter: Option<Arc<dyn GrepPreviewHighlighter>>PH.3: optional preview highlighter, captured at
construction like config. None ⇒ plain previews
(e.g. tests, or a host that doesn’t wire syntax).
Implementations§
Source§impl GrepSource
impl GrepSource
Trait Implementations§
Source§impl PickerSourceGenerator for GrepSource
impl PickerSourceGenerator for GrepSource
Source§fn init(
&self,
ctx: &PickerContext<'_>,
args: &[String],
) -> SourceResult<PickerInitResult>
fn init( &self, ctx: &PickerContext<'_>, args: &[String], ) -> SourceResult<PickerInitResult>
Slice 3: optional initial pattern. With no pattern the
picker opens empty (no grep runs); the first keystroke
triggers the live flow through on_query_changed.
With an initial pattern the grep runs immediately –
async via the Future variant so the UI thread doesn’t
park on the first invocation either. The host seeds
picker.query with the initial pattern (live-source
convention in App::open_picker), so subsequent
keystrokes extend the same query.
Source§fn on_query_changed(
&self,
ctx: &PickerContext<'_>,
query: &str,
) -> Option<SourceResult<PickerInitResult>>
fn on_query_changed( &self, ctx: &PickerContext<'_>, query: &str, ) -> Option<SourceResult<PickerInitResult>>
Slice 3: live re-execution. The host’s
drain_pending_live_picker_query calls this every time
the debounce expires; we trim, special-case the empty
query (no grep, empty result – clears the candidate
list), and otherwise spawn the grep on the blocking
pool. The Future variant lets the host cancel us if a
newer keystroke fires before we finish.
Source§fn spec(&self) -> &PickerSourceSpec
fn spec(&self) -> &PickerSourceSpec
:describe-picker /
:picker <Tab> listings without cloning.Source§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 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