Expand description
LSP modeline element (ML.3c) + the shared progress/status store it is
built from. Produced entirely in lattice-lsp (the owner) and pushed
over the event bus.
§Why a forwarder task + shared store here, not host accumulation
Decision (A): $/progress + experimental/serverStatus are LSP
protocol state, so their accumulation belongs in lattice-lsp, not
dispatch.rs. The LSP actor only parses and emits these as events
(actor.rs); nothing accumulates them server-side. This module owns
that accumulation in LspProgressStore (an ArcSwap-backed shared
handle):
- the forwarder task subscribes the relevant events, folds them
into the store, and publishes [
ModelineElementUpdate] for each LSP-attached buffer — exactly as a WASM plugin would (docs/dev/architecture/modeline.md§6). The host’s §12 wake forwarder turns each push into an off-keystroke repaint; no producer runs on the render path (paramount #1). - the host reads the same store (via the
LspProgressStoreHandleit stashes at boot, the pattern it already uses forLspSupervisorHandle) for:lsp-progress-cancel, which needs the in-flight cancellable-token list. One accumulator, two readers — no duplication, and the accumulation logic + state are out of the host.
Per-buffer keying gates the badge to LSP buffers: content is pushed
keyed Buffer(id) for each attached buffer (the badge is process-wide
today, so every attached buffer gets the same value) and cleared on
detach. A non-LSP pane has no lsp content and renders nothing.
Replaces the retired LspMode::status_line_items (badge) +
LspProgressMode::status_line_items (progress) pull and the host-side
drain_lsp_progress_events / drain_lsp_server_status accumulators.
Structs§
- LspProgress
Store - The relocated LSP progress/status accumulator (decision A). The LSP
actor only emits
$/progress/serverStatusas events; this is the single place they are folded into a queryable map. TwoArcSwaps for wait-free reads + lock-free single-writer (forwarder) updates, so the host can readSelf::progress_snapshotfrom the actor thread for:lsp-progress-cancelwhile the off-actor forwarder writes.
Constants§
- LSP_
ELEMENT - Modeline element id for the LSP readiness badge + progress. Owned by
lattice-lsp(feedback_mode_owns_its_surface).
Functions§
- lsp_
content - Build the
lspelement content from progress + server-status maps. Always non-empty (the badge always shows on an attached buffer):lsp ✗on any health error,lsp ⟳while any server is busy / a$/progresstoken is in flight, elselsp ✓, with the highest-percentage in-flight token’s<title> NN%appended. Glyphs are BMP-safe (lsp-architecture.md §14). Pure — unit-tested. - register_
lsp_ modeline_ element - Register the
lspdescriptor (ML.3c). PaneLocal (content pushed per attached buffer), Right zone beforecore.position(priority 5). - spawn_
modeline_ forwarder - Spawn the LSP modeline forwarder (ML.3c). Subscribes the four event
types, folds progress/status into the shared
store, and republishes thelspelement content per attached buffer on every change. The host wires this at boot with the shared bus + the store handle it also keeps for:lsp-progress-cancel+ the LSP runtime handle. A closed bus (all senders dropped) ends the task cleanly — never panics.
Type Aliases§
- LspProgress
Store Handle - Shared handle to the
LspProgressStore— the host stashes one at boot; the forwarder writes through its clone.