Skip to main content

RoutingPayload

Enum RoutingPayload 

Source
pub enum RoutingPayload {
Show 24 variants Buffer { id: u32, }, PaneHistoryEntry { index: u32, }, ResolveDiff { primary: u32, accept: bool, }, LspInstance { server_id: String, workspace: PathBuf, }, AiSession { provider: String, index: u32, }, LspLocation { path: PathBuf, line: u32, col: u32, }, LspCompletion { index: u32, }, LspCodeAction { index: u32, }, OpenFile { path: PathBuf, }, JumpInBuffer { buffer_id: u32, line: u32, col: u32, }, InvokeCommand { id: String, args: Args, }, PasteRegister { name: char, }, JumpToMark { name: char, }, ExpandSnippet { id: String, }, AcceptShowMessageAction { request_id: u32, action_index: u32, }, LspCodeLens { index: u32, }, ColorPresentation { index: u32, }, Colorscheme { name: String, }, LoadCommandLine { text: String, }, LoadSearchLine { text: String, }, BranchBase { name: String, }, SuppliedValue { value: String, }, FileLocation { path: PathBuf, line: u32, col: u32, }, Create { query: String, },
}
Expand description

Typed payload the picker accept dispatch reads to figure out which side effect to run. Replaces the tab-encoded string payloads stuffed into RawCandidate.text in earlier phases (Phase 4.2.g.7 polish).

One variant per PickerAction; the variant naturally communicates the dispatch path AND carries the typed data the handler needs (no string parsing, no fragility around \t in paths). The PickerAction tag stays for now – the App’s dispatch matches on it first to choose the code path; future cleanup could pivot to matching on the payload variant alone since the two always agree, but the redundancy is harmless.

Variants§

§

Buffer

PickerAction::SwitchToBuffer – the host’s buffer id (newtype-wrapped u32 host-side; we hold the raw value to keep the picker module renderer-agnostic).

Fields

§id: u32
§

PaneHistoryEntry

PBH.5: one entry in the ACTIVE pane’s buffer trail, identified by its index rather than its buffer id — the same buffer can appear at several points in a trail, and picking the third stop must land on the third stop.

Accepting moves the walk cursor rather than pushing a visit: the picker is random access over the existing trail, not a new navigation. Pushing would append a duplicate and make <C-7> unreachable, exactly as an unsuppressed walk would.

Fields

§index: u32
§

ResolveDiff

Resolve a specific pending diff review by its primary buffer id with Accept (accept = true) or Reject. Emitted by the diff-review picker (:diff-accept / :diff-reject with >1 pending review) so the user chooses WHICH diff to resolve. primary is the raw host BufferId.

Fields

§primary: u32
§accept: bool
§

LspInstance

PickerAction::OpenLspLog / OpenLspTraceLog – the supervisor key. workspace rides for completeness but today’s handlers only use server_id.

Fields

§server_id: String
§workspace: PathBuf
§

AiSession

PickerAction::OpenAiLog – the AI session key (provider + per-provider index) the host reconstructs into a SessionKey to open *ai:<provider>:<index>*. Ephemeral (sessions come and go), so routing_identity returns None — no MRU recency.

Fields

§provider: String
§index: u32
§

LspLocation

PickerAction::JumpToLspLocation – canonical (path, line, col) the host’s jump_to_file_line_col consumes. LSP 0-based line + utf-8 byte column; the host already converted these utf-8 host-side at ingestion time.

Fields

§path: PathBuf
§line: u32
§col: u32
§

LspCompletion

PickerAction::AcceptLspCompletion – numeric index into the host’s pending_completion_items snapshot.

Fields

§index: u32
§

LspCodeAction

PickerAction::AcceptLspCodeAction – numeric index into the host’s pending_code_action_items snapshot.

Fields

§index: u32
§

OpenFile

PickerAction::OpenFile – canonical filesystem path the accept dispatch hands to App::do_edit(Some(path), false). Used by the file picker (:files) and the recent-files picker; directories defer to oil/file-tree the same way :e DIR does.

Fields

§path: PathBuf
§

JumpInBuffer

PickerAction::JumpInBuffer – jump to (line, col) in an already-registered buffer. Captured at picker-open time so the destination is stable even if the user arrowed through another picker’s hover-preview. Emitted by :picker lines, :picker jumps (for entries pointing at currently-open buffers), and – once migrated – :picker marks. MRU returns None for this variant because (line, col) drift as the buffer is edited; a stale identity would mis-rank candidates.

Fields

§buffer_id: u32
§line: u32
§col: u32
§

InvokeCommand

Invoke an ex-command by stable id. Emitted by the command palette (:picker commands); the host resolves id against its CommandRegistry, builds a CommandInvocation, and routes through the same dispatcher the : line uses. args carries any pre-supplied positional arguments (the command palette today emits Args::None; future “pick a thing, then run a command on it” flows will carry richer values).

Fields

§args: Args
§

PasteRegister

Paste a named register’s contents at the cursor. Emitted by :picker registers; name is the single- char register identifier (a..z, 0..9, +, ", etc.). The host’s apply_picker_outcome::PasteRegister arm sets the pending register and runs the normal paste path so charwise / linewise / blockwise distinction is honored.

Fields

§name: char
§

JumpToMark

Jump to a named mark (mX). Emitted by :picker marks. The host resolves the mark to a position via its existing do_jump_mark path so the cursor placement + position-history push match the keyboard-driven behavior. name carries a stable identity, so MRU will record mark:<name> once slice 14 lands.

Fields

§name: char
§

ExpandSnippet

Expand a snippet by name at the cursor. Emitted by :picker snippets. The host resolves the body through SnippetRegistry::by_name and routes through the existing :snippet-expand path. MRU keys on snip:<name>.

Fields

§

AcceptShowMessageAction

Accept one action from a server-initiated window/showMessageRequest. request_id keys into the App’s lsp_pending_show_message_requests map (the slot that holds the inbound oneshot); action_index selects which MessageActionItem from the request’s actions vec ferries back to the server. Dismiss (Esc) routes through do_picker_dismiss which replies null (i.e. the user closed the prompt without picking).

Fields

§request_id: u32
§action_index: u32
§

LspCodeLens

4.5.d – PickerAction::AcceptLspCodeLens. Numeric index into the host’s pending_code_lens_items snapshot (a clone of the active buffer’s code-lens cache at picker-open time). The accept dispatch resolves the lens (if it arrived without a command) and routes the resulting command through workspace/executeCommand on the originating server.

Fields

§index: u32
§

ColorPresentation

4.5.e – PickerAction::AcceptColorPresentation. Numeric index into the host’s pending_color_presentations snapshot. Accept splices the chosen ColorPresentation.text_edit (or label fallback) into the buffer at the cached color range.

Fields

§index: u32
§

Colorscheme

T.12: the theme name a colorscheme-picker candidate carries. Both accept and live-preview resolve the name against the ThemeRegistry catalog and swap the active theme.

Fields

§name: String
§

LoadCommandLine

MB.3: the past command a history-picker candidate carries. Accept loads text into the editable : line via the host’s open_command_line seam — it does not execute (the user tweaks / <C-x><C-e>s it, then <CR>s). Emitted by the history picker source (q: / :history). Ephemeral by nature — routing_identity returns None, so no MRU recency (the history ring is already recency-ordered).

Fields

§text: String
§

LoadSearchLine

MB.5: load text into the editable / search line. Emitted by the search-history picker source (q/ / q? / :history search). The host opens the *search-line* buffer with Forward direction and seeds the pattern; the user tweaks it, then <CR> to execute. Ephemeral — no MRU recency.

Fields

§text: String
§

BranchBase

The branch name a base-branch-picker candidate carries. Emitted by magit’s branch-create wizard (c in magit-branch-mode): the user picks an existing branch as the base, then accept opens a follow-up text prompt for the new branch’s name (PickerAcceptOutcome::OpenPrompt, stashing this name in the prompt buffer’s synthetic name).

Fields

§name: String
§

SuppliedValue

MG.53.e: a plain value the picked candidate stands for, for a source that answers a question rather than performing an action.

Carried by file-pick and consumed by whatever parked itself waiting for a value — today a picker-backed transient argument. The source does not know what the value is for, which is the point: one registered file listing serves every argument that names a file.

Fields

§value: String
§

FileLocation

OR.6: a place in a file on disk — (path, line, col).

The peer PickerAcceptOutcome::JumpToLocation already had and the routing side lacked. Without it a source whose rows stand for positions in files can only carry Self::OpenFile, which drops the line — so a row for a heading halfway down a file lands at the top of it. Org-roam’s headline nodes are 19% of its corpus and every one of them lands wrong without this.

Distinct from Self::LspLocation, which is the same shape under a name that says where it came from. Reusing it would have worked and read as a lie in every source that is not an LSP result.

No MRU identity: a location is not an identity — the same line means something different after an edit above it.

Fields

§path: PathBuf
§line: u32
§col: u32
§

Create

OR.5: the query the user typed, carried by the picker’s synthetic create row — the offer to make the thing they were looking for and did not find.

Emitted by the picker itself rather than by a source: a source declares create_label on its spec and the picker appends the row, so every source gets the behaviour from one declaration and none of them re-implements it. accept routes back to the source, which decides what creation means — org-roam mints a node, another source might make a file or a branch. The picker never knows.

query is verbatim, spaces and non-ASCII included. The source is creating something the user named, so trimming or normalising here would be the picker having an opinion about a namespace it does not own.

Fields

§query: String

Implementations§

Source§

impl RoutingPayload

Source

pub fn error_location( &self, resolver: &dyn BufferPathResolver, ) -> Option<ErrorLocation>

Where this entry points, when it points into a file on disk — the picker’s own translation of a row into an error-list location.

This is what makes <C-q> (send-to-error-list) generic over every picker: the host no longer decides which payloads have a location, the payload does. A plugin picker that emits Self::FileLocation across the WIT boundary gets error-list support for free, without the host learning about it.

Exhaustive by construction — there is deliberately no _ arm. Every variant decides here: a location (and how), or None (a register, a command, a buffer id — nothing to jump to). A new payload variant will not compile until it declares its mapping. The earlier host-side match carried a wildcard and silently dropped Self::FileLocation, so a plugin picker’s file rows sent nothing; folding coverage into the type turns that silent gap into a compile error.

Trait Implementations§

Source§

impl Clone for RoutingPayload

Source§

fn clone(&self) -> RoutingPayload

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RoutingPayload

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more