Skip to main content

Module status

Module status 

Source
Expand description

IDE-protocol I7: the claude-code modeline status segment.

Shows the IDE server’s state — running/port + live connection count — on the modeline of every buffer running claude-code-mode (the agent terminal). Mode-owned per feedback_mode_owns_its_surface: claude-code-mode’s on_activate registers its buffer here and the returned Guard unregisters it on deactivate; the descriptor + the off-thread publisher live in this crate (the host only owns the generic ModelineService + the render path).

Mirrors lattice-lsp::modeline: a producer pushes content keyed ModelineKey::Buffer(id) over the event bus (ML.3); the host’s §12 wake forwarder turns each push into an off-keystroke repaint, so nothing runs on the render path (paramount #1). The publisher only republishes when the rendered text actually changes, so a quiescent server produces no repaints.

Structs§

MentionState
D-fix.6 follow-up: a transient @sent echo on the modeline after a :claude-send pushes context to the agent. Unlike the review badge (a lifecycle span), an at-mention is a momentary event, so the echo is time-boxed: ping() stamps a clear-deadline + wakes the publisher, which shows @sent until the deadline then clears itself (the publisher waits on the wake OR the deadline, whichever comes first).
ReviewGuard
RAII guard: decrements the pending-review count + wakes the publisher on Drop. Held across open_diff’s await so a cancelled / dropped review can’t leak the count high.
ReviewState
D-fix.6 follow-up: shared pending-review counter, mode-owned. claude-code produces every openDiff and awaits its outcome (diff::open_diff), so the span from request-sent to outcome-resolved IS a pending review — no host signal needed. begin() (called by open_diff around its await) bumps the count + wakes the status publisher; the returned ReviewGuard decrements + wakes on Drop, so the count is correct even if the connection drops or the task is cancelled mid-review.

Constants§

STATUS_ELEMENT
Modeline element id — owned by the MCP adapter (lattice_ai::mcp) (feedback_mode_owns_its_surface; the namespace is the owner key).

Functions§

project_name
The project name shown in the status segment — the basename of the first workspace folder (e.g. /home/me/src/lattice → lattice). Empty when no workspace folder is configured, in which case the project segment is hidden.
register_status_descriptor
Register the claude-code descriptor with the host’s modeline registry. Right zone, low priority so it sits near the LSP / position elements.
spawn_status_publisher
Spawn the status publisher task. Wakes on changed (start/stop, a connection open/close, or a buffer (un)registering), rebuilds the content, and republishes it to each registered buffer only when it differs from what that buffer last showed; a removed buffer is cleared (empty content).
status_content
Build the status content for the current server state. Empty when the server is stopped (the element hides itself — no stale “off” badge cluttering the modeline when the IDE isn’t running).

Type Aliases§

IdeBuffers
The set of buffers (agent terminals) currently showing the status, shared between the mode (registers/unregisters) and the publisher task (reads).
MentionHandle
Cheap-clone handle to the shared MentionState.
ReviewHandle
Cheap-clone handle to the shared ReviewState.