pub struct CompletionSourceContribution {
pub id: SourceId,
pub default_priority: u32,
pub auto_trigger: bool,
pub trigger_chars: Vec<char>,
pub popup_filter_chord: Option<char>,
pub accepts_non_word_query: bool,
pub kind: CompletionSourceKind,
}Expand description
One source’s contribution to the active completion set for a
buffer. Returned from lattice_mode::Mode::completion_sources (the
new declarative contribution method on Mode – see
lattice-mode). The aggregator’s per-buffer cache holds a
list of these; the active-source resolver in the host
recomputes the cache only on mode-activation / -deactivation
transitions, so the keystroke-frequency refilter pays an
O(1) buffer-local lookup.
Cloning is cheap: every field is either Copy or an Arc.
Fields§
§id: SourceIdStable identifier ("gen:lsp-completion",
"gen:buffer-words", …). Surfaces in :set completion.source.<id>.priority=..., in :describe-mode <name> output, and in the per-language sources allowlist.
default_priority: u32Default priority bucket. Higher buckets sort above lower;
the host’s per-buffer priority_for_source override may
replace this value before the ranker reads it.
auto_trigger: boolWhether typing identifier chars opens the popup with this
source included. Manual triggers (<C-x><C-o> /
<C-Space>) always include every enabled source.
trigger_chars: Vec<char>Server-advertised or source-supplied characters that
should fire this source. Empty = “fire on identifier-
threshold or manual.” The LSP source populates this from
completionProvider.triggerCharacters at activation.
popup_filter_chord: Option<char>CSM.K1 (insert-completion.md §12): single-char filter
chord inside completion-popup-mode. Some('o') ⇒
<C-o> while the popup is live narrows the rendered
candidate set to only this source’s contributions
(mnemonic: o for omni → LSP). None ⇒ no dedicated
chord; the source still participates in the unfiltered
all-sources view + any TOML allowlist.
CSM.K2 wires the binding – completion-popup-mode’s
keymap walks ActiveCompletionSources at push time and
registers <C-?> for every contribution whose
popup_filter_chord is Some. Until then this field
is plumbing: CSM.4 – CSM.8 fill it in for each migrated
source so CSM.K2 can ship one slice’s worth of behavior
at a time.
accepts_non_word_query: boolOR.7: this source can still match after a non-word character is typed, so the popup must not dismiss on one.
The host closes the popup as soon as the query contains a byte that is not a word character — the right default, because a query is normally an identifier and vim closes there too. It is wrong for a source whose candidates are phrases: org-roam completes node titles like “Honey Garlic Chicken Breast”, and the popup used to die at the first space, which made every multi-word title unreachable.
Per-source rather than global because the dismissal is right for buffer-words and identifiers; the host ORs the flag across the round, so one phrase source keeps the popup alive and every other source simply stops matching, which is the correct outcome for them.
kind: CompletionSourceKindThe actual producer – sync or async.
Trait Implementations§
Source§impl Clone for CompletionSourceContribution
impl Clone for CompletionSourceContribution
Source§fn clone(&self) -> CompletionSourceContribution
fn clone(&self) -> CompletionSourceContribution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more