Expand description
Host-built snapshot the picker primitive hands to source
generators on every :picker <source> open.
PickerContext is the runtime-varying “where am I”
state every picker source needs: the active buffer, the
workspace root, the recent-files MRU, marks, registers,
and the position-history ring. It does NOT carry feature-
specific facades (LSP supervisor handle, snippet registry,
grammar registry) – those are captured by source
generators at construction time. See
docs/dev/architecture/picker.md for why.
The struct is borrow-heavy by design: sync sources read
straight through the borrows, async sources clone what
they need into their future’s captures before the
synchronous init call returns. Three fields are owned
vecs (buffers, marks, registers) – the App rebuilds
these fresh on each picker-open because their backing
state lives in non-borrow-friendly types (HashMaps with
transient liveness). Allocation cost is trivial at our
sizes (<100 buffers, <26 marks, <40 registers).
Structs§
- Active
Buffer Snapshot - Snapshot of the active document buffer at the moment the picker opened. Carries enough state for line / mark / outline / grep / LSP-position sources to do their work without a second App round-trip.
- Buffer
Entry - One buffer in the registry, projected for picker rows.
kind_labelis a display string – the picker primitive stays oblivious to the actualBufferKindenum so the “no kind-specific logic” rule (CLAUDE.md memory) holds at this seam too. - Pane
History Row - PBH.5: one row of the active pane’s buffer trail, flattened for the picker.
- Picker
Context - Snapshot the host passes to
PickerSourceGenerator::init(andaccept) on each picker invocation. - Position
Entry - Picker-friendly view of one entry in the App’s
position-history ring (§5.1.1 unified jump list + mark
ring). The App’s richer
PositionEntrycarriesBufferKind+ framework-internal fields; the picker only needs(buffer_id, line, col, source)to render a row and emit a jump outcome.
Enums§
- Position
Source - Why this entry was pushed onto the position history.
Mirror of
lattice_ui_tui::app::PositionSourcebut kept here solattice-pickerdoesn’t depend on the host crate. The App translates between the two at PickerContext-build time.