pub struct AiConversationMode { /* private fields */ }Expand description
ai-conversation-mode – major mode for the *ai:opencode* buffer.
Holds the prompt’s editable-region anchor: the absolute line where the
prompt begins (== the transcript line count). The drain updates it on each
re-projection; editable_tail publishes it so the
read-only gate lets the user edit a multi-line prompt (<C-j> inserts a
newline) while the transcript above stays frozen. One instance backs the
single (v1) conversation buffer, so one shared anchor suffices.
AUX‑2: headerline_version is bumped by the drain on each re-projection so
the ConversationHeaderline widget republishes its row when usage changes.
Implementations§
Trait Implementations§
Source§impl Clone for AiConversationMode
impl Clone for AiConversationMode
Source§fn clone(&self) -> AiConversationMode
fn clone(&self) -> AiConversationMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for AiConversationMode
impl Default for AiConversationMode
Source§impl Mode for AiConversationMode
impl Mode for AiConversationMode
Source§fn invocation_runner(&self) -> Option<ModeId>
fn invocation_runner(&self) -> Option<ModeId>
AU‑3 gap fix: claim the invocation runner so vim operators respect the
editable tail. The host registers Editor::run_editable_tail_invocation
under this mode id (editor_boot.rs); it gates mutating operators
(x / dd / dw) started in the frozen transcript and lets them
through in the prompt. Without a runner, operators fell through to the
ungated document path and mutated the read-only transcript.
Source§fn implies(&self) -> &[ModeId]
fn implies(&self) -> &[ModeId]
Pull in repl-mode on the conversation buffer: it owns the generic
insert-entry surface (i/a/o/… → jump-to-prompt-and-Insert). The
activation cascade turns it on wherever this major is active and off
when the buffer’s major changes, so the affordance is scoped to the
REPL buffer without a bespoke keymap on this mode.
Source§fn editable_tail(&self) -> Option<EditableTail>
fn editable_tail(&self) -> Option<EditableTail>
AU‑3: the prompt is the single trailing line, editable only after the
"> " marker (2 bytes). Consulted by the host’s read-only edit gate so
Insert/operator keystrokes land only in the prompt; the transcript above
stays owner-written.
Source§fn keymap(&self) -> Keymap
fn keymap(&self) -> Keymap
AU‑3: the modal-input surface. Insert-entering chords relocate the
cursor into the prompt first (so Insert only ever edits the prompt, and
history is unreachable from Insert); <CR> sends; <C-c> interrupts.
The host’s K.2.4 translate pass pushes these under
MajorMode(ai-conversation-mode), gated by K.1.c to this buffer.
Source§fn action_handlers(&self) -> Vec<ActionHandlerContribution>
fn action_handlers(&self) -> Vec<ActionHandlerContribution>
AU‑3: the handler bodies for the chords above, mode-owned (no host
Editor:: method, no Action variant). Bound at boot by the host’s
register_mode_action_handlers walk. Each reads the buffer / services
from the [ActionContext] and returns an [Effect] the host applies.
Source§type Guard = Option<AiConversationGuard>
type Guard = Option<AiConversationGuard>
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 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 on_activate(&self, ctx: ModeContext) -> LifecycleFuture<'_, Self::Guard>
fn on_activate(&self, ctx: ModeContext) -> LifecycleFuture<'_, Self::Guard>
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 more§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 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 more§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 more§fn refresh_on_open(&self) -> bool
fn refresh_on_open(&self) -> bool
§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).Auto Trait Implementations§
impl Freeze for AiConversationMode
impl RefUnwindSafe for AiConversationMode
impl Send for AiConversationMode
impl Sync for AiConversationMode
impl Unpin for AiConversationMode
impl UnsafeUnpin for AiConversationMode
impl UnwindSafe for AiConversationMode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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