Replaces the bare 'LSP {state} . N diagnostics' span in the file preview header with the existing LspStatusIndicator component, which was already authored, tested, and shipped on main but had no parent rendering it.
What you now get on the workspace file preview header:
- Spinning loader for starting/idle, green check for ready, red alert with N error count when ready+errors, red retry button when unavailable
- Click the pill to open a diagnostics dropdown listing path:line:col plus truncated message; Enter on a row opens that file in the preview
- Retry button round-trips POST /api/sessions/:id/lsp/restart and re-reads state, since LspManager keeps unavailable workspaces sticky until an explicit restart
Type bridge:
- The server wire shape (WorkspaceLspState: idle/starting/ready/unavailable with an error string) does not carry LspUnavailableReason, but LspStatusIndicator was authored against the legacy four-state shape with reason+errorCount
- New pure adapter desktop/src/lib/lspStateMap.ts maps the two shapes: idle-as-starting, ready threads errorCount derived from severity=error diagnostics, unavailable collapses to init-failed (Retry path)
Tested:
- bunx vitest src/lib/lspStateMap.test.ts (8 cases — all four state transitions plus diagnostic severity counting)
- bunx vitest LspStatusIndicator + workspacePanelStore — 53/53 pass
- bun run lint (tsc --noEmit) clean
Not-tested: live-LSP retry round-trip (covered by lspManager server tests separately)
Confidence: high
Scope-risk: narrow
Co-authored-by: 你的姓名 <you@example.com>