Expand description
Events published by the core to subscribed clients.
Per DESIGN.md §5.10: every meaningful editor state transition
publishes a typed event. Vim’s autocmd and emacs’s hooks both
desugar to the same EventBus::subscribe call (filter +
sink). The Event enum is the catalog; EventKind is the
discriminator used by filter dispatch.
This is the closed catalogue: editor-core transitions the host owns.
Feature crates declare their own events as types through
crate::event_registry instead of growing this enum, and plugins
publish theirs through the one open arm, Event::Plugin.
The bus itself (lattice_runtime::EventBus) is not here — this crate has
no runtime. Publishing is fire-and-forget unless a variant says otherwise.
Most variants are also delivered to WASM plugins (mirrored in WIT by
lattice-plugin-host); the ones marked host-internal below are refused
at that boundary.
Versions: version fields carry lattice_core::Document’s counters.
Event::DocumentOpened carries the text version (bumps on text
changes only); Event::DocumentChanged and Event::SelectionsChanged
carry the whole-document version, which also bumps on selection changes.
§Examples
use lattice_protocol::{DocumentId, Event, EventKind};
use std::path::PathBuf;
let saved = Event::DocumentSaved {
id: DocumentId::new(3),
path: PathBuf::from("src/lib.rs"),
};
// Filters bucket on the payload-free discriminator.
assert_eq!(saved.kind(), EventKind::DocumentSaved);
assert_eq!(Event::BeforeQuit.kind(), EventKind::BeforeQuit);Structs§
- Applied
Edit - An edit as actually applied to the buffer (the original
Editplus the resulting range, useful for clients that want to know what changed).
Enums§
- Event
- One editor-core state transition, as published on the event bus.
- Event
Kind - Discriminator for
Eventvariants. Stored inEventFilter::kindsand used by the bus to bucket subscriptions per kind so publish does no global iteration. - Task
Outcome - MG.41g: how a
Event::BackgroundTaskFinishedended.