Skip to main content

AnnotationColumns

Struct AnnotationColumns 

Source
pub struct AnnotationColumns { /* private fields */ }
Expand description

MARG.5 (2026-06-03): pre-computed per-category column layout for the picker / completion annotation column. The renderer builds one of these from the visible candidate set, then renders each row against it — every row’s annotation cells line up vertically because each column width is the max across visible candidates and rows that don’t have a particular category render a blank cell of the same width.

Why this lives in lattice-completion rather than the renderer crates: both peer renderers (TUI + GPUI) need identical column-width math; centralising avoids two implementations drifting apart. The layout is data, not paint — peers consume it differently (ratatui spans vs. GPUI element-tree), but the column widths are universal.

Display order is variant-fixed via category_order: keybinding -> source -> kind -> doc -> custom (custom slots come last, grouped at the end). Source sits right after keybinding so the user sees which mode contributes the chord at a glance.

Implementations§

Source§

impl AnnotationColumns

Source

pub fn from_visible<'a, I>(candidates: I) -> Self
where I: IntoIterator<Item = &'a RenderedCandidate>,

Build the column layout from a borrowed iterator over the visible candidates. chars().count() is used for width — matches what display_text() yields and what monospace terminals draw. (Combining-char / wide-glyph edge cases are not handled here for parity with the existing display_col_chars calculation in the picker caller; a future Unicode-width pass would land in both sites at once.)

Source

pub fn iter(&self) -> impl Iterator<Item = (&str, usize)>

Iterate (category_key, column_width) pairs in display order. Renderers walk this once per row; for each column they either render the candidate’s matching annotation (padded to column_width) or a blank cell of column_width spaces.

Source

pub fn is_empty(&self) -> bool

True when no visible candidate carries any annotation. Renderers skip the annotation-column rendering entirely (including the leading pad-to-display_col spacing) when this is true.

Trait Implementations§

Source§

impl Clone for AnnotationColumns

Source§

fn clone(&self) -> AnnotationColumns

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 AnnotationColumns

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for AnnotationColumns

Source§

fn default() -> AnnotationColumns

Returns the “default value” for a type. 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.

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