pub enum PickerPreviewOutcome {
Colorscheme {
name: String,
},
Buffer {
name: String,
text: String,
syntax_path: Option<PathBuf>,
},
}Expand description
MG.54: result of PickerSourceGenerator::preview, the hook that
fires as the SELECTION moves rather than on <CR>.
Deliberately not PickerAcceptOutcome, which it used to be.
That enum answers “what does accepting this candidate do”, and it
worked as a preview vocabulary only by the accident that
ApplyColorscheme happens to mean the same thing in both contexts.
Showing text in a pane does not: it is a projection the host tears
down on <Esc>, never something a <CR> performs. Adding it to the
accept enum would have put a variant there that no accept path can
honour — and the next preview-only payload would have compounded it.
A plugin source implementing preview therefore gets a type whose
every variant is valid where it is returned (paramount #2).
Variants§
Colorscheme
T.12: apply the named theme while the selection sits on it. The
host snapshots the pre-open theme on the first preview and
restores it on <Esc>. Swaps the GLOBAL theme, not a buffer, so
it is orthogonal to the buffer projection below.
Buffer
MG.54: show text in the active pane as a read-only projection
— the pane’s committed buffer is untouched and snaps back when
the picker closes.
For content that has no file to read: a git blob at a revision,
a generated listing, a plugin’s rendering. syntax_path is the
path the content would have (src/main.rs for
git show HEAD:src/main.rs) and drives language detection only;
nothing reads it from disk. None previews as plain text.
The source hands over text it has ALREADY fetched. Whatever it
costs to produce is the source’s problem, and a source whose
production is expensive says so via
PickerSourceGenerator::preview_debounce so the host only
asks once the selection settles.
Trait Implementations§
Source§impl Clone for PickerPreviewOutcome
impl Clone for PickerPreviewOutcome
Source§fn clone(&self) -> PickerPreviewOutcome
fn clone(&self) -> PickerPreviewOutcome
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PickerPreviewOutcome
impl Debug for PickerPreviewOutcome
impl Eq for PickerPreviewOutcome
Source§impl PartialEq for PickerPreviewOutcome
impl PartialEq for PickerPreviewOutcome
impl StructuralPartialEq for PickerPreviewOutcome
Auto Trait Implementations§
impl Freeze for PickerPreviewOutcome
impl RefUnwindSafe for PickerPreviewOutcome
impl Send for PickerPreviewOutcome
impl Sync for PickerPreviewOutcome
impl Unpin for PickerPreviewOutcome
impl UnsafeUnpin for PickerPreviewOutcome
impl UnwindSafe for PickerPreviewOutcome
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.