pub struct SourceRegistration {
pub spec: SourceSpec,
pub kind: CandidateSourceKind,
pub accept: Option<Arc<dyn AcceptHandler>>,
pub matcher_override: Option<MatcherId>,
pub ranker_overrides: Vec<RankerId>,
pub annotator_extras: Vec<AnnotatorId>,
}Expand description
The substrate: bundle of every input the pipeline needs to produce + dispatch a source’s candidates.
Lives in lattice-completion (the abstraction layer); the
host (lattice-host) holds the per-app CompletionRegistry
and stores registrations there. Both surfaces — picker and
cmdline-completion — consume registrations through the
registry.
Two lifecycles (cross-check § “Two registration lifecycles”):
-
Persistent: registered at boot via
CompletionRegistry::register_source, lives until shutdown. First-party Files / Buffers / Commands etc. Plugin sources whose data is synchronously enumerable. -
Transient: constructed per-use by the host (LSP pickers building from async responses) or a plugin (async- fetch), passed directly to
Picker::open_with(reg), dropped after accept/dismiss. Same shape; just shorter lifetime.
Fields§
§spec: SourceSpec§kind: CandidateSourceKind§accept: Option<Arc<dyn AcceptHandler>>Accept handler. None ⇒ candidate selection is
effectively a no-op (rare; cmdline-completion sources
today don’t carry an explicit handler — the accept logic
is inline. Slice 7c migrates those to explicit handlers
returning AcceptAction::InsertText).
matcher_override: Option<MatcherId>Per-source matcher override. None ⇒ use the registry
default.
ranker_overrides: Vec<RankerId>Per-source ranker chain override. Empty ⇒ use the registry default chain.
annotator_extras: Vec<AnnotatorId>Additional annotators to run on this source’s candidates, in registration order. Appended to (not replacing) the registry default annotators.