Expand description
Candidate value types that flow through the completion pipeline (DESIGN.md §5.11.3).
Three shapes, one per pipeline stage:
RawCandidate– output of a generator. Insertion text + kind + structured payload.ScoredCandidate– after the matcher:RawCandidate+ score + the byte ranges the matcher considered “matched” (vertico’s match-face highlights these).RenderedCandidate– after annotators: above + a vec of typedAnnotations the renderer paints to the right of each candidate (MARG.1, seedocs/dev/architecture/marginalia.md).
Three shapes (not one with optional fields) so the type system
enforces stage ordering: a generator produces only RawCandidates;
a matcher produces only ScoredCandidates; annotators only mutate
RenderedCandidates. Pipeline order can’t accidentally invert.
Structs§
- Annotation
Columns - 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.
- Annotation
Segment - MARG §8: one run of marginalia text sharing a theme slot,
the unit of an
Annotation::Styledcell.slotis a theme element name the renderer resolves at paint time (unknown slot → the custom/plugin annotation color); it is NEVER a baked color, so a:colorschemeswap recolors it live on both peers. - Cache
Key - Cache key for
crate::CandidateGenerator::cache_key. Treated as opaque by the caching layer; semantic meaning is per-generator. - Display
Span - PH.1: a syntax-styled run within a candidate’s
displaytext. Carries a semanticStyle(a closed enum with an existingStyle → ElementIdmap), NOT a resolved color — the renderer resolves it viaresolve_syntax_styleat paint so:colorschemerecolors live, mirroring theAnnotation::Styledcarry-semantic / resolve-at-seam invariant (marginalia §3 / §8.2).rangeis a byte range intodisplay. - Match
Score - Score the matcher assigned. Higher is better;
0means “doesn’t match” (and the candidate is filtered out before it becomes aScoredCandidate). - RawCandidate
- Output of a generator. The pipeline passes these through the matcher next.
- Rendered
Candidate - What the renderer paints. Annotators append to
annotations; the renderer paints each typedAnnotationwith the style that category resolves to, joined by two spaces of row-styled padding. MARG.1 (2026-06-03): replacedVec<String>withVec<Annotation>so annotation category survives into the paint path. - Scored
Candidate - A
RawCandidateplus the matcher’s verdict. Survives the match stage; consumed by the ranker and (in turn) the annotators.
Enums§
- Annotation
- One annotation attached to a completion candidate.
- Candidate
Data - Generator-supplied metadata travelling alongside the candidate.
Annotators read this to produce display text without re-querying
the underlying registry. Plugin generators stash their own
payload in
Extension(msgpack on the wire when WASM lands). - Candidate
Kind - What kind of thing this candidate is. Drives icon / colour /
grouping in the popup, and (for CommandKind) hints at the
follow-up
:describe-*target.