pub enum PickerAcceptOutcome {
Show 19 variants
OpenFile {
path: PathBuf,
},
SwitchBuffer {
buffer_id: u32,
},
JumpInBuffer {
buffer_id: u32,
line: u32,
col: u32,
},
JumpToMark {
name: char,
},
JumpToLocation {
path: PathBuf,
line: u32,
col: u32,
},
InvokeCommand {
id: String,
args: Args,
},
PasteRegister {
name: char,
},
ExpandSnippet {
id: String,
},
OpenLspLog {
server_id: String,
},
OpenLspTraceLog {
server_id: String,
},
ApplyLspCodeAction {
handle: u64,
index: u32,
},
ApplyLspCompletion {
index: u32,
},
ApplyColorscheme {
name: String,
},
LoadCommandLine {
text: String,
},
LoadSearchLine {
text: String,
},
WalkPaneHistory {
index: u32,
},
OpenPrompt {
prompt: String,
initial: String,
on_submit_action: String,
buffer_name: Option<String>,
},
FillCaller {
text: String,
},
NoOp,
}Expand description
Result of PickerSourceGenerator::accept. The host
pattern-matches and runs the corresponding mutation.
New variants are added when (and only when) a concrete
picker source needs an action the existing set can’t
express. Resist re-using Effect directly: a tighter
outcome set is easier to audit, easier to mirror in WIT,
and stops source generators from emitting arbitrary
grammar effects that bypass picker conventions.
Variants§
OpenFile
Edit the file at path. Host routes through
App::do_edit, which handles the “already-open” +
new-file branches uniformly.
SwitchBuffer
Switch the active pane to an existing buffer by id.
JumpInBuffer
Move the cursor within buffer_id. If buffer_id
is the active pane’s buffer, only the cursor moves;
otherwise the host activates that buffer first.
Picker sources use this for in-buffer jumps where
the buffer is already loaded (:picker lines,
:picker marks against the active doc).
JumpToMark
Jump to a named mark. The host resolves the mark’s position itself – the source doesn’t need to.
JumpToLocation
Jump to path:line:col. If path isn’t the active
buffer, the host opens it first. Used by LSP
locations, grep hits, outline jumps – anywhere the
destination might or might not already be open.
InvokeCommand
Dispatch an ex-command by id with the provided
args. The command palette (:picker commands) uses
this; future plugin sources may emit it for chained
behaviors (“pick a thing, then run a command on it”).
PasteRegister
Paste a register’s contents at the current cursor.
name is the single-char register identifier
(a-z, 0-9, ", +, etc.).
ExpandSnippet
Expand a snippet by id at the current cursor.
OpenLspLog
Open the per-server LSP log buffer.
OpenLspTraceLog
Open the per-server LSP trace-log buffer (distinct from the regular log; carries the protocol trace).
ApplyLspCodeAction
Apply a resolved LSP code action by index into the
host’s pending_code_action_items snapshot.
handle is the cancellation token / request handle
the action was registered against (carried by the
host for resolve-then-apply correlation).
ApplyLspCompletion
Apply an LSP completion item by index into the
host’s pending_completion_items snapshot.
ApplyColorscheme
T.12: apply the named theme via the ThemeRegistry catalog; host calls apply_theme + signals ThemeChanged. Emitted by the colorscheme picker on both accept and live preview.
LoadCommandLine
MB.3: load text into the editable : command line WITHOUT
executing it. Host routes through Editor::open_command_line,
exactly as if the user had typed : and the text by hand —
they then tweak (or <C-x><C-e> expand) and <CR> to run.
Emitted by the history picker source (q: / :history).
LoadSearchLine
MB.5: load text into the editable / search line WITHOUT
executing it. Host routes through Editor::open_search_line
(Forward direction) + set_search_line_text — the user tweaks
and <CR> to execute. Emitted by the search-history picker
source (q/ / q? / :history search).
WalkPaneHistory
PBH.5: walk the active pane’s buffer trail to index — a MOVE of
the walk position, not a new visit, so the forward tail stays
reachable. Host routes through Editor::do_pane_history_jump.
Emitted by the pane-buffer-history source; host-internal (a
plugin has no pane trail to name).
Its own variant rather than NoOp-plus-host-fallback: the source
used to return NoOp expecting the legacy routing arm to do the
walk, but a registered generator’s outcome is applied INSTEAD of
that arm, so <CR> closed the picker and went nowhere.
OpenPrompt
Open a generic one-line minibuffer text prompt —
picker-accept’s peer of Effect::OpenPrompt (same fields, same
name-based on_submit_action lookup, no closures). Lets a
source chain “pick an item, then type a value” (e.g. magit’s
branch-create: pick the base branch via this picker, then
prompt for the new branch’s name) without inventing bespoke
per-source plumbing. buffer_name, when set, stashes context
(e.g. the picked base branch) in the prompt buffer’s synthetic
name for the submit handler to read back.
FillCaller
YR.3 / MG.53.e: the picked item’s text, for whatever opened the picker.
The outcome for a source that answers a question rather than
performing an action. Where the text lands is not the source’s
business and not encoded here — the host consumes the
FillTarget it captured when the picker was opened. The same
file-pick list fills a magit argument; the same yank-ring
list fills the document, the : line, a prompt, or another
picker’s query.
Deliberately not InvokeCommand. A source that supplies text
does not know, and must not decide, what the text is for. Baking
a command into the source would mean one registered source per
consumer, which is the duplication this exists to avoid.
The host echoes and drops it when no target was captured; text arriving with nowhere to go is a wiring bug, not a user error, and silently discarding it would present as a picker that does nothing.
NoOp
Picker dismissed without action – source-side
abort, accept-on-empty filter, etc. Host applies no
mutation. Distinct from Err returned from accept
(which echoes an error message); NoOp is the
silent “nothing to do here” path.
Trait Implementations§
Source§impl Clone for PickerAcceptOutcome
impl Clone for PickerAcceptOutcome
Source§fn clone(&self) -> PickerAcceptOutcome
fn clone(&self) -> PickerAcceptOutcome
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more