Expand description
SN.3b — config-driven snippet activation policy.
SnippetMode’s ActivationPolicy
is folded from two user-facing options the mode owns
([[feedback_mode_owns_its_surface]]):
snippet.activation(global|supported-languages|off, defaultglobal) — the gate shape. A closed three-value set, so it’s a typed enum (SnippetActivationMode) with anOptionTypeimpl, giving:set snippet.activation=<Tab>completion the same wayfoldmethoddoes.snippet.languages(default empty) — a comma-separated language-id allowlist, consulted only whensnippet.activation = supported-languages. It’s a plainStringbecause the typed-option loader rejects TOML arrays for scalar options (lattice_config::loader::apply_scalar):snippet.languages = "rust,python"in TOML, or:set snippet.languages=rust,python.
The host folds both into a shared
SnippetActivationPolicyHandle at boot and re-folds on the
apply_option_cascade arm for either key (:set live). The
resolver reads SnippetMode::activation_policy() — which loads
the shared cell — on each MajorEntered, so new buffers pick up
the live policy. (Already-open buffers are not retroactively
re-resolved in SN.3b; the policy applies on their next major
entry.)
Structs§
- Snippet
Activation - Which buffers get snippets. Default
global— snippets on every document buffer, each buffer seeing only its own language’s snippets (the completion source self-filters by language).supported-languagesrestricts activation to thesnippet.languagesallowlist;offdisables auto-activation entirely. - Snippet
Languages - Comma-separated language ids for which snippets activate when
snippet.activation = supported-languages. Each idLmaps to the major modeL-mode, so only registered majors match (today: rust / python / javascript / markdown). Ignored whensnippet.activationisglobaloroff. A list (not a scalar) in spirit, but stored as a string because the typed- option loader rejects TOML arrays:snippet.languages = "rust,python".
Enums§
- Snippet
Activation Mode snippet.activation— which buffers get snippets.
Functions§
- fold_
activation_ policy - Fold
snippet.activation+snippet.languagesinto the concrete [ActivationPolicy] the resolver consults.
Type Aliases§
- Snippet
Activation Policy Handle - Shared, swappable snippet activation policy.
SnippetModereads it viaactivation_policy(); the host folds config into it at boot and on everysnippet.activation/snippet.languages:set. Cloning the outerArcshares the same cell — the host’sEditorkeeps one clone tostore()into and the mode keeps another toload()from.