Skip to main content

Module traits

Module traits 

Source
Expand description

The four pluggable traits the pipeline composes.

Each is its own extension point. Plugins (post-WASM) register impls against the crate::CompletionRegistry just like they register commands or keymaps. Default impls ship as built-ins (crate::builtins::*).

Structs§

GenerateContext
Snapshot of editor state a generator may need to consult. Held by reference so the pipeline borrows from the surrounding frame for the duration of the call. Generators that don’t need buffer or registry state simply ignore those fields.

Traits§

CandidateAnnotator
Decorates a candidate with display metadata (right-side text in the popup – marginalia’s role). Multiple annotators are active simultaneously; they run in registration order, each appending a typed crate::Annotation to candidate.annotations. The renderer paints each annotation with the style its category resolves to and joins consecutive annotations with two spaces.
CandidateGenerator
Produces raw candidates for a slot. Implementations vary from pure (gen:commands walks the registry) to side-effecting (gen:files reads the filesystem). Caching is opt-in via Self::cache_key – the default is “no cache”.
CandidateMatcher
Matches and scores candidates against a query string. The default v1 matcher (match:prefix) returns Some only when the query is a prefix of candidate.text. The fuzzy matcher (orderless-equivalent) returns sub-character match ranges and a score that decays with skipped chars.
CandidateRanker
Reorders the matched + scored candidate set. The default (rank:score) sorts by descending score; rank:alphabetical is an alternative. Plugin rankers can implement frecency, recency, smart-case ordering, etc.