Skip to main content

Module context

Module context 

Source
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§

ActiveBufferSnapshot
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.
BufferEntry
One buffer in the registry, projected for picker rows. kind_label is a display string – the picker primitive stays oblivious to the actual BufferKind enum so the “no kind-specific logic” rule (CLAUDE.md memory) holds at this seam too.
PaneHistoryRow
PBH.5: one row of the active pane’s buffer trail, flattened for the picker.
PickerContext
Snapshot the host passes to PickerSourceGenerator::init (and accept) on each picker invocation.
PositionEntry
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 PositionEntry carries BufferKind + framework-internal fields; the picker only needs (buffer_id, line, col, source) to render a row and emit a jump outcome.

Enums§

PositionSource
Why this entry was pushed onto the position history. Mirror of lattice_ui_tui::app::PositionSource but kept here so lattice-picker doesn’t depend on the host crate. The App translates between the two at PickerContext-build time.