pub struct BufferWordsMode;Expand description
CSM.4 (insert-completion.md §12 first source migration):
buffer-words-mode – contributes the buffer-words
completion source. Auto-activates on writable buffer kinds
(Document) so the popup’s all-sources view shows words
scraped from the active buffer’s text. popup_filter_chord = Some('b') ⇒ <C-b> inside completion-popup-mode narrows
the popup to buffer-words only.
Placement: lives in lattice-mode::modes::completion
alongside CompletionMode. Ideal location would be
lattice-completion::modes (the “feature crate owns its
mode” rule), but Mode is defined in lattice-mode and the
dep direction is lattice-mode → lattice-completion
(CSM.1); the Mode impl can’t live in lattice-completion
without a cycle. The source struct (BufferWordsSource)
stays in lattice-completion::insert where it belongs;
only the thin Mode adapter sits here.
Implementations§
Trait Implementations§
Source§impl Mode for BufferWordsMode
impl Mode for BufferWordsMode
Source§fn kind(&self) -> ModeKind
fn kind(&self) -> ModeKind
activate_major on a minor, or vice versa, is
ModeActivationError::WrongKind).Source§fn options(&self) -> OptionOverrideSet
fn options(&self) -> OptionOverrideSet
lattice_config::overrides! { lattice_config::Wrap = true, … }.Source§fn required_capabilities(&self) -> CapabilitySet
fn required_capabilities(&self) -> CapabilitySet
ModeActivationError::MissingCapability, never silent
skip.Source§fn completion_sources(&self) -> Vec<CompletionSourceContribution>
fn completion_sources(&self) -> Vec<CompletionSourceContribution>
lsp-completion-mode,
snippet-completion-mode, buffer-words-mode,
tree-sitter-completion-mode, path-completion-mode,
plugin sources) override.Source§fn on_activate(&self, _ctx: ModeContext) -> LifecycleFuture<'_, ()>
fn on_activate(&self, _ctx: ModeContext) -> LifecycleFuture<'_, ()>
Guard
carrying every resource the mode allocated. The
dispatcher stashes the Guard until deactivation, at which
point dropping it performs cleanup via the Guard’s Drop
impl. Read moreSource§fn target_buffer_kind(&self) -> Option<BufferKind>
fn target_buffer_kind(&self) -> Option<BufferKind>
BufferKind] this mode is the default
major for (H.2, 2026-05-31). ModeRegistry::register
indexes this so
ModeRegistry::find_major_for_kind can
dispatch buffer-creation events to the right major without
host-side match BufferKind { ... } blocks. Read moreSource§fn target_language(&self) -> Option<&str>
fn target_language(&self) -> Option<&str>
Lang::name() —
"rust", "org") (OM.1). The peer of
target_buffer_kind for the
dispatch path [BufferKind::Document] takes: language
detection rather than kind dispatch. Read moreSource§fn decorations(&self) -> Vec<DecorationProvider>
fn decorations(&self) -> Vec<DecorationProvider>
Source§fn gutter_decorations(&self, _ctx: &DecorationCtx<'_>) -> Vec<GutterDecoration>
fn gutter_decorations(&self, _ctx: &DecorationCtx<'_>) -> Vec<GutterDecoration>
DecorationCtx
carrying relevant render-state snapshots (diff sign map, LSP
diagnostics arc). Returns per-line GutterDecoration values;
the renderer partitions them by variant into the appropriate
gutter column. Default: empty (no contribution).Source§fn action_handlers(&self) -> Vec<ActionHandlerContribution>
fn action_handlers(&self) -> Vec<ActionHandlerContribution>
action_handlers() once at boot, resolves each
action_name → CommandId, registers the handler in the
ActionHandlerRegistry, and holds the tokens for the app’s
lifetime. Use this for handlers that read the active
buffer / cursor / services from the ActionContext at call
time and close over no per-buffer state (e.g. snippet
expand). Per-buffer, session-scoped handlers register in
on_activate instead, so their tokens
drop with the Guard. Default: none. See
feedback_effect_vocabulary_is_host_boundary.Source§fn conflicts_with(&self) -> &[ModeId]
fn conflicts_with(&self) -> &[ModeId]
Source§fn implies(&self) -> &[ModeId]
fn implies(&self) -> &[ModeId]
relative-line-numbers-mode ⇒ line-numbers-mode, and by
read-only majors ⇒ read-only-mode. Read moreSource§fn presents_extensions(&self) -> &[&'static str]
fn presents_extensions(&self) -> &[&'static str]
Source§fn mirrors_option(&self) -> Option<&'static str>
fn mirrors_option(&self) -> Option<&'static str>
Some(canonical_name) ⇒ a host-driven cascade keeps the
mode’s active state and the option’s value in sync.Source§fn invocation_runner(&self) -> Option<ModeId>
fn invocation_runner(&self) -> Option<ModeId>
ModeId; the host registers a
runner function under that id at boot, and
Editor::run_invocation looks it up by walking the
active modes on the active pane’s buffer (minors first,
then major) before falling back to the central grammar
Action gate. Read moreSource§fn refresh_action(&self) -> Option<&'static str>
fn refresh_action(&self) -> Option<&'static str>
None (the default) when the mode backs nothing
refreshable (RV.1, 2026-08-10). Read moreSource§fn fold_toggle_action(&self) -> Option<&'static str>
fn fold_toggle_action(&self) -> Option<&'static str>
<Tab> fires, and the declaration that
pulls in
foldable-view-mode —
the shared minor owning the chord. Read moreSource§fn refresh_on_open(&self) -> bool
fn refresh_on_open(&self) -> bool
Source§fn activation_policy(&self) -> ActivationPolicy
fn activation_policy(&self) -> ActivationPolicy
admits the entered major. The
default is ActivationPolicy::Manual — auto-activate
nowhere until the mode or the user opts in. Ignored for major
modes (a buffer’s major is chosen by the major resolver, not
this allowlist).Source§fn editable_tail(&self) -> Option<EditableTail>
fn editable_tail(&self) -> Option<EditableTail>
None (the default) for a fully read-only / fully writable buffer
(AU‑3). Read moreAuto Trait Implementations§
impl Freeze for BufferWordsMode
impl RefUnwindSafe for BufferWordsMode
impl Send for BufferWordsMode
impl Sync for BufferWordsMode
impl Unpin for BufferWordsMode
impl UnsafeUnpin for BufferWordsMode
impl UnwindSafe for BufferWordsMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<M> DynMode for Mwhere
M: Mode,
impl<M> DynMode for Mwhere
M: Mode,
Source§fn kind(&self) -> ModeKind
fn kind(&self) -> ModeKind
Mode::kind.Source§fn target_buffer_kind(&self) -> Option<BufferKind>
fn target_buffer_kind(&self) -> Option<BufferKind>
Mode::target_buffer_kind.Source§fn target_language(&self) -> Option<&str>
fn target_language(&self) -> Option<&str>
Mode::target_language.Source§fn options(&self) -> OptionOverrideSet
fn options(&self) -> OptionOverrideSet
Mode::options.Source§fn keymap(&self) -> Keymap
fn keymap(&self) -> Keymap
Mode::keymap.Source§fn decorations(&self) -> Vec<DecorationProvider>
fn decorations(&self) -> Vec<DecorationProvider>
Mode::decorations.Source§fn gutter_decorations(&self, ctx: &DecorationCtx<'_>) -> Vec<GutterDecoration>
fn gutter_decorations(&self, ctx: &DecorationCtx<'_>) -> Vec<GutterDecoration>
Mode::gutter_decorations.Source§fn completion_sources(&self) -> Vec<CompletionSourceContribution>
fn completion_sources(&self) -> Vec<CompletionSourceContribution>
Mode::completion_sources.Source§fn action_handlers(&self) -> Vec<ActionHandlerContribution>
fn action_handlers(&self) -> Vec<ActionHandlerContribution>
Mode::action_handlers.Source§fn required_capabilities(&self) -> CapabilitySet
fn required_capabilities(&self) -> CapabilitySet
Mode::required_capabilities.Source§fn conflicts_with(&self) -> &[ModeId]
fn conflicts_with(&self) -> &[ModeId]
Mode::conflicts_with.Source§fn implies(&self) -> &[ModeId]
fn implies(&self) -> &[ModeId]
Mode::implies.Source§fn presents_extensions(&self) -> &[&'static str]
fn presents_extensions(&self) -> &[&'static str]
Mode::presents_extensions.Source§fn mirrors_option(&self) -> Option<&'static str>
fn mirrors_option(&self) -> Option<&'static str>
Mode::mirrors_option.Source§fn invocation_runner(&self) -> Option<ModeId>
fn invocation_runner(&self) -> Option<ModeId>
Mode::invocation_runner.Source§fn refresh_action(&self) -> Option<&'static str>
fn refresh_action(&self) -> Option<&'static str>
Mode::refresh_action.Source§fn fold_toggle_action(&self) -> Option<&'static str>
fn fold_toggle_action(&self) -> Option<&'static str>
Mode::fold_toggle_action.Source§fn refresh_on_open(&self) -> bool
fn refresh_on_open(&self) -> bool
Mode::refresh_on_open.Source§fn activation_policy(&self) -> ActivationPolicy
fn activation_policy(&self) -> ActivationPolicy
Mode::activation_policy.Source§fn editable_tail(&self) -> Option<EditableTail>
fn editable_tail(&self) -> Option<EditableTail>
Mode::editable_tail.Source§fn on_activate_dyn<'a>(
&'a self,
ctx: ModeContext,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, ModeActivationError>> + Send + 'a>>
fn on_activate_dyn<'a>( &'a self, ctx: ModeContext, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, ModeActivationError>> + Send + 'a>>
Box<dyn Any + Send>.
The dispatcher stashes this box keyed by
(BufferId, ModeId); deactivation drops it.