Skip to main content

Module events

Module events 

Source
Expand description

LSP-owned editor-bus events (M.5.3.b).

Three concrete event types replacing the LSP variants that used to live in the central lattice_protocol::Event enum. Each registers via [lattice_protocol::register_event!] so :describe-events (M.5.3.c) and any future event-introspection tooling sees them. The editor’s [lattice_runtime::EventBus::publish_typed] / [lattice_runtime::EventBus::subscribe_typed] surface dispatches and downcasts.

Why these live here: the central Event enum was a single sealed type that every feature crate had to edit to publish. Moving LSP events to lattice-lsp puts them under their owner’s authority – same model lattice-mode uses for the Mode trait.

Structs§

LspActorExited
Fired when an actor task exits (4.4.d). The supervisor subscribes to this event to drive crash-detection auto-restart: Clean exits (after a Shutdown command) are ignored; Unexpected exits trigger the supervisor’s restart-with-backoff path. The supervisor is the single subscriber today; plugin telemetry can subscribe later without further plumbing.
LspBufferAttached
Fired after lsp-mode activates on a buffer and the supervisor has queued the textDocument/didOpen. The semantic counterpart to LSP’s didOpen on the editor’s bus: the buffer is now LSP-tracked. Subscribers (statusline, future plugin hooks, telemetry) react without polling App::active_modes.
LspBufferDetached
Fired when lsp-mode deactivates on a buffer and the supervisor has sent textDocument/didClose to attached servers. The buffer remains open in the editor; only LSP tracking ends. Server connection persists if other buffers are still attached.
LspCodeLensRefresh
4.5.d: server-issued workspace/codeLens/refresh request surfaces as this typed bus event. Same shape as the other refresh events; the App-side drain evicts cached code lenses for every buffer attached to the requesting server.
LspDiagnosticRefresh
4.4.j: fired when an attached server requests workspace/diagnostic/refresh. The host invalidates the pull-diagnostics result_id cache for every buffer attached to this server; the next render tick re-issues textDocument/diagnostic (without a previous_result_id, so the server must answer with a Full report) and the DiagnosticsLayer re-applies.
LspDocumentChanged
Fired when a document buffer changes and lsp-mode is active for that buffer (M.5.5). The per-actor fan-in (crate::fan_in) subscribes via EventBus::subscribe_typed::<LspDocumentChanged> and forwards each AppliedEdit as a RecordEdit actor command.
LspInlayHintRefresh
4.4.g: fired when an attached server requests workspace/inlayHint/refresh. The host invalidates every cached inlay-hint entry for buffers attached to this server; the next render tick re-issues inlayHint and repopulates.
LspLogPushed
Fired when crate::LspLogger::log appends a record to a log ring (subsystem-wide when server_id is None, per-server otherwise). Subscribers (the App’s drain hook) refresh open *lsp* / *lsp:<server>* / *lsp:<server>:trace* help buffers from the logger snapshot so log views update live as records arrive.
LspProgressUpdate
Fired when an attached server sends a $/progress notification (LSP §3.16 work-done progress). The host accumulates progress entries by (server_id, token) and surfaces the most recent active one in the modeline.
LspSemanticTokensRefresh
4.4.i: fired when an attached server requests workspace/semanticTokens/refresh. The host invalidates every cached semantic-tokens entry for buffers attached to this server; the next render tick re-issues semanticTokens/full (forcing a fresh baseline rather than a delta against a now-stale result_id) and repopulates.
LspServerStatusChanged
L2: fired when a server sends experimental/serverStatus (rust-analyzer’s readiness extension). quiescent is the gold-standard “ready” signal – false while the server is scanning / indexing, true once it has finished and features (hover, diagnostics, completion) are reliable. health is the server’s self-assessed condition. The host turns this into the modeline’s ✓/⟳/✗ readiness glyph.

Enums§

LspActorExitReason
LspProgressKind
LspServerHealth