pub struct RgSource {
pub items: Arc<Mutex<Vec<RgMatch>>>,
/* private fields */
}Expand description
Source for the ripgrep content-search picker.
Bonsai-agnostic — preview returns the file contents only. The host
(e.g. apps/hjkl) layers syntax spans via preview_path.
Fields§
§items: Arc<Mutex<Vec<RgMatch>>>Implementations§
Trait Implementations§
Source§impl PickerLogic for RgSource
impl PickerLogic for RgSource
Source§fn requery_mode(&self) -> RequeryMode
fn requery_mode(&self) -> RequeryMode
How the picker should react when the query changes.
Source§fn item_count(&self) -> usize
fn item_count(&self) -> usize
Number of items currently available (grows as enumeration progresses).
Source§fn match_text(&self, idx: usize) -> String
fn match_text(&self, idx: usize) -> String
Text the fuzzy scorer scores against. May equal
label.Source§fn has_preview(&self) -> bool
fn has_preview(&self) -> bool
Whether this source wants the preview pane.
Source§fn preview(&self, idx: usize) -> (Buffer, String)
fn preview(&self, idx: usize) -> (Buffer, String)
Build the preview pane for the row. Default: empty buffer. Read more
Source§fn preview_path(&self, idx: usize) -> Option<PathBuf>
fn preview_path(&self, idx: usize) -> Option<PathBuf>
File-system path the preview’s content was loaded from, when one
exists. Used by the host to drive language-aware preview rendering
(e.g. tree-sitter syntax highlighting). Default
None for sources
whose preview has no on-disk path (an in-memory snapshot, a help
message, etc.).Source§fn preview_top_row(&self, idx: usize) -> usize
fn preview_top_row(&self, idx: usize) -> usize
Initial scroll position (top row) for the preview viewport.
Sources that show a windowed preview around a specific line override
this so the gutter line numbers reflect the actual file line. Default 0.
Source§fn preview_match_row(&self, idx: usize) -> Option<usize>
fn preview_match_row(&self, idx: usize) -> Option<usize>
0-based row to visually mark in the preview (e.g. grep match line).
Default
None → no highlight. Returning Some(row) tells the
renderer to paint a cursor_line_bg across that row.Source§fn select(&self, _idx: usize) -> PickerAction
fn select(&self, _idx: usize) -> PickerAction
Translate the picked row into an action.
Source§fn label_match_positions(
&self,
idx: usize,
query: &str,
label: &str,
) -> Option<Vec<usize>>
fn label_match_positions( &self, idx: usize, query: &str, label: &str, ) -> Option<Vec<usize>>
Override the highlight positions for the row at
idx. Read moreSource§fn enumerate(
&mut self,
query: Option<&str>,
cancel: Arc<AtomicBool>,
) -> Option<JoinHandle<()>>
fn enumerate( &mut self, query: Option<&str>, cancel: Arc<AtomicBool>, ) -> Option<JoinHandle<()>>
Re-enumerate items. Read more
Source§fn preview_line_offset(&self, idx: usize) -> usize
fn preview_line_offset(&self, idx: usize) -> usize
Added to the gutter line numbers in the preview. Sources that
snapshot a window of a larger document (e.g. buffer picker
snapshotting ±N lines around the cursor) use this so the gutter
shows the original document line numbers rather than restarting
at 1. Default 0.
Source§fn handle_key(&self, idx: usize, key: KeyEvent) -> Option<PickerAction>
fn handle_key(&self, idx: usize, key: KeyEvent) -> Option<PickerAction>
Handle a key before the picker’s default handling. Return
Some(action)
to short-circuit and emit that action immediately. Return None to let
the picker handle the key normally. Default: None.Source§fn preserve_source_order(&self) -> bool
fn preserve_source_order(&self) -> bool
Whether the picker should keep the source’s enumeration order when
the query is empty. Default
false means empty-query rows are sorted
by match-text ascending. Sources that pre-sort meaningfully (e.g. by
recency, by HEAD-first) override to true.Auto Trait Implementations§
impl Freeze for RgSource
impl RefUnwindSafe for RgSource
impl Send for RgSource
impl Sync for RgSource
impl Unpin for RgSource
impl UnsafeUnpin for RgSource
impl UnwindSafe for RgSource
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
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