pub struct MagitCoreMode;Implementations§
Source§impl MagitCoreMode
impl MagitCoreMode
Trait Implementations§
Source§impl Mode for MagitCoreMode
impl Mode for MagitCoreMode
Source§fn implies(&self) -> &[ModeId]
fn implies(&self) -> &[ModeId]
The navigation chords live in magit-nav-mode; read-only views
get them by implication so nothing changes for them, and an
EDITABLE magit view can imply that mode alone without inheriting
the bare letters below.
Source§fn refresh_action(&self) -> Option<&'static str>
fn refresh_action(&self) -> Option<&'static str>
RV.2 (2026-08-10): magit-refresh is every magit buffer’s refresh.
Declared once here, on the minor that spans every magit view —
which is the same reason gr was bound here rather than
per-view. The chord itself now lives on refreshable-view-mode,
pulled in by the implies cascade because this returns Some; the
handler body is untouched. See
docs/dev/architecture/mode-architecture.md §5.5.
Source§fn fold_toggle_action(&self) -> Option<&'static str>
fn fold_toggle_action(&self) -> Option<&'static str>
OA.4b: <Tab> comes from foldable-view-mode now; magit declares
only its BODY. The specialisation is real and stays — on a status file
line the first press expands the diff so <Tab> and = agree, and
everywhere else it is the plain fold toggle.
<S-Tab> is not declared because it never needed to be: magit’s
action:magit-cycle-sections body was literally
Effect::AppAction(AppEffect::CycleFoldsGlobal), which is what the
shared mode’s own action evaluates to. The copy is deleted.
Source§fn refresh_on_open(&self) -> bool
fn refresh_on_open(&self) -> bool
Re-opening a magit buffer re-runs that refresh.
Every magit view’s content is a snapshot of the repository, and
synthetic buffers are created once and reused by name — so the
mode’s on_activate, which fills the buffer, ran on the first
open only. C-x g on an already-open *magit:status* therefore
showed the repo as it was when the buffer was first created:
commits made since, files staged in a terminal, a branch switch,
none of it visible, and nothing on screen saying the view was
old. Reported from use, and the failure is quiet by nature — a
stale status buffer looks exactly like a current one.
Declared here rather than per-view for the same reason
refresh_action is: it is true of every magit buffer (status,
log, branch, stash, diff, …), and the copied-set gap this rule
prevents is precisely the one where a view is left out and nobody
notices.
The body satisfies the self-contained contract: trigger_refresh
spawns the git work off-thread and returns no effect, so nothing
on this path needs the dispatch outcome — and the refresh costs
the actor thread nothing.
Source§fn action_handlers(&self) -> Vec<ActionHandlerContribution>
fn action_handlers(&self) -> Vec<ActionHandlerContribution>
MG.13: every magit-core chord, registered once at boot.
None of these need per-buffer state — they read the buffer
through BufferStoreHandle using ctx.buffer_id, so they are
pure functions of the ActionContext. That matters twice over:
this mode is a minor active on every magit buffer, so
per-activation registration meant N registrations of the same
action id with two magit buffers open — last-wins, and the first
deactivation unregistering the chord for both.
gr, s and u are the shared actions: gr is bound here,
while s/u are bound by magit-status-mode and
magit-diff-mode. Either way the handler must exist exactly
once, so all three live here and dispatch per-buffer through
MagitView. The binding still belongs to whichever mode offers
the chord — a buffer whose mode does not bind s never routes
one here.
Source§fn on_activate(&self, _ctx: ModeContext) -> LifecycleFuture<'_, Self::Guard>
fn on_activate(&self, _ctx: ModeContext) -> LifecycleFuture<'_, Self::Guard>
MG.13: nothing to do per activation — every chord this mode
contributes is registered at boot by action_handlers(). The
Guard is empty; it exists only to satisfy the lifecycle
contract (a fresh Guard per activation).
Source§type Guard = ActionRegsGuard
type Guard = ActionRegsGuard
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 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 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.§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 more§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 more§fn decorations(&self) -> Vec<DecorationProvider>
fn decorations(&self) -> Vec<DecorationProvider>
§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).§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.§fn conflicts_with(&self) -> &[ModeId]
fn conflicts_with(&self) -> &[ModeId]
§fn presents_extensions(&self) -> &[&'static str]
fn presents_extensions(&self) -> &[&'static str]
§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.§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 more§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 MagitCoreMode
impl RefUnwindSafe for MagitCoreMode
impl Send for MagitCoreMode
impl Sync for MagitCoreMode
impl Unpin for MagitCoreMode
impl UnsafeUnpin for MagitCoreMode
impl UnwindSafe for MagitCoreMode
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<M> DynMode for Mwhere
M: Mode,
impl<M> DynMode for Mwhere
M: Mode,
§fn target_buffer_kind(&self) -> Option<BufferKind>
fn target_buffer_kind(&self) -> Option<BufferKind>
Mode::target_buffer_kind].§fn target_language(&self) -> Option<&str>
fn target_language(&self) -> Option<&str>
Mode::target_language].§fn decorations(&self) -> Vec<DecorationProvider>
fn decorations(&self) -> Vec<DecorationProvider>
Mode::decorations].§fn gutter_decorations(&self, ctx: &DecorationCtx<'_>) -> Vec<GutterDecoration>
fn gutter_decorations(&self, ctx: &DecorationCtx<'_>) -> Vec<GutterDecoration>
Mode::gutter_decorations].§fn completion_sources(&self) -> Vec<CompletionSourceContribution>
fn completion_sources(&self) -> Vec<CompletionSourceContribution>
Mode::completion_sources].§fn action_handlers(&self) -> Vec<ActionHandlerContribution>
fn action_handlers(&self) -> Vec<ActionHandlerContribution>
Mode::action_handlers].§fn required_capabilities(&self) -> CapabilitySet
fn required_capabilities(&self) -> CapabilitySet
Mode::required_capabilities].§fn conflicts_with(&self) -> &[ModeId]
fn conflicts_with(&self) -> &[ModeId]
Mode::conflicts_with].§fn presents_extensions(&self) -> &[&'static str]
fn presents_extensions(&self) -> &[&'static str]
Mode::presents_extensions].§fn mirrors_option(&self) -> Option<&'static str>
fn mirrors_option(&self) -> Option<&'static str>
Mode::mirrors_option].§fn invocation_runner(&self) -> Option<ModeId>
fn invocation_runner(&self) -> Option<ModeId>
Mode::invocation_runner].§fn refresh_action(&self) -> Option<&'static str>
fn refresh_action(&self) -> Option<&'static str>
Mode::refresh_action].§fn fold_toggle_action(&self) -> Option<&'static str>
fn fold_toggle_action(&self) -> Option<&'static str>
Mode::fold_toggle_action].§fn refresh_on_open(&self) -> bool
fn refresh_on_open(&self) -> bool
Mode::refresh_on_open].§fn activation_policy(&self) -> ActivationPolicy
fn activation_policy(&self) -> ActivationPolicy
Mode::activation_policy].§fn editable_tail(&self) -> Option<EditableTail>
fn editable_tail(&self) -> Option<EditableTail>
Mode::editable_tail].§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