pub struct DiffMode;Expand description
diff-mode minor. Empty marker in v1 (D.5.a): the bit other
layers consult. D.5.b/c land the do/dp chord bindings
against the MinorMode(ModeId::new("diff-mode")) keymap
layer (K.1.b shape).
Implementations§
Trait Implementations§
Source§impl Mode for DiffMode
impl Mode for DiffMode
Source§fn keymap(&self) -> Keymap
fn keymap(&self) -> Keymap
MO.x (2026-06-24): contribute the do/dp chords through the
standard Mode::keymap() seam (the multibuffer ]e/[e pattern).
The host’s K.2.4 translation pass resolves each entry’s cmd name
against the CommandRegistry and pushes the layer under
MinorMode(diff-mode), gated to diff-active buffers by K.1.c —
retiring the host’s bespoke explicit push_layer (the emacs-keys
host-push that DX.5/DX.7 left as this follow-up). The binding choice
now lives wholly with the mode; the host pushes nothing diff-specific.
Source§fn action_handlers(&self) -> Vec<ActionHandlerContribution>
fn action_handlers(&self) -> Vec<ActionHandlerContribution>
CR.1 (2026-06-24): the do/dp chord handler bodies, now
mode-owned (they were Editor::do_diff_get/do_diff_put +
Action::DiffGet/DiffPut host-side). Bound globally
(buffer-agnostic) at boot by the host’s register_mode_action_handlers
walk: diff-mode is active on many buffers at once and the
ActionHandlerRegistry is keyed by CommandId alone, so a
per-on_activate registration would let one buffer’s deactivation
evict the handler for the others — the snippet action:snippet-expand
precedent. Each handler reads the active buffer + cursor from the
ActionContext and the diff session from the DiffSubsystemHandle
service, resolves the hunk via DiffSubsystem::diff_*_effect, and
hands the host an Effect::ApplyEdit (CR.0): the mode owns the
resolution, the host owns the apply. do/dp pass None as the
target (auto-resolve the peer in 2-way; “target required” in 3-way);
the :diffget/:diffput optional <bufnr> is a separate host call
into the same diff_*_effect resolver.
Source§fn on_activate(
&self,
ctx: ModeContext,
) -> Pin<Box<dyn Future<Output = Result<DiffModeGuard, ModeActivationError>> + Send + '_>>
fn on_activate( &self, ctx: ModeContext, ) -> Pin<Box<dyn Future<Output = Result<DiffModeGuard, ModeActivationError>> + Send + '_>>
DX.3-C7 (2026-06-24) / D-fix.5 (2026-06-26): register the buffer’s diff fold sources.
Mirrors MultibufferMode::on_activate: pull the
FoldOverlayService + the data handle (DiffSubsystemHandle) +
the ConfigRegistry from the service registry, resolve the diff
session and the buffer’s ranges slot, and register TWO sources
over them:
HunkFoldSource— folds the hunks (open by default);UnchangedFoldSource(D-fix.5) — folds their complement, the unchanged gaps (closed by default; vimdifffoldmethod=diff).
D-fix.5 resolves via lookup_session_for (not the primary-only
lookup) + participant_slot, so EVERY participant — including
the baseline-side secondary buffer — registers sources folding
its OWN side. Both panes fold in lockstep; under scroll-bind,
folding only one side would desync the side-by-side view.
The returned DiffModeGuard’s Drop removes both sources when
the mode deactivates. Missing service / no session / no slot just
skips (empty guard) — folds inactive, never a panic.
Source§type Guard = DiffModeGuard
type Guard = DiffModeGuard
Self::on_activate. Read moreSource§fn kind(&self) -> ModeKind
fn kind(&self) -> ModeKind
activate_major on a minor, or vice versa, is
ModeActivationError::WrongKind).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 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 options(&self) -> OptionOverrideSet
fn options(&self) -> OptionOverrideSet
lattice_config::overrides! { lattice_config::Wrap = true, … }.Source§fn decorations(&self) -> Vec<DecorationProvider>
fn decorations(&self) -> Vec<DecorationProvider>
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 required_capabilities(&self) -> CapabilitySet
fn required_capabilities(&self) -> CapabilitySet
ModeActivationError::MissingCapability, never silent
skip.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 DiffMode
impl RefUnwindSafe for DiffMode
impl Send for DiffMode
impl Sync for DiffMode
impl Unpin for DiffMode
impl UnsafeUnpin for DiffMode
impl UnwindSafe for DiffMode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for 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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more