on main help sign in
fix(ui): subscribe to `app.LSPEvent` instead of `workspace.LSPEvent` (#2565)

Fix LSP UI display broken in v0.55.0. The UI was still subscribing to workspace.LSPEvent after the event type was moved to the app package, causing LSP status to never update in the UI. Changes: - internal/ui/model/ui.go: Subscribe to app.LSPEvent; use app.GetLSPStates() - internal/ui/model/lsp.go: Use app.LSPClientInfo type for LSPInfo embedding and sorting (fields are identical to workspace.LSPClientInfo) Fixes charmbracelet/crush#2560

commit85445d7f50b004722f568496d61c2d7e2b51fb7a authorChris Chen <fuleinist@outlook.com> dateThu 9 Apr 2026, 03:17 (6 months ago) parent2e07c0d
2 files changed+8−7
internal/ui/model/lsp.go+3−3 internal/ui/model/ui.go+5−4
internal/ui/model/lsp.go+3−3
@@ -7,16 +7,16 @@ import (
77 "strings"
88
99 "charm.land/lipgloss/v2"
10+ "github.com/charmbracelet/crush/internal/app"
1011 "github.com/charmbracelet/crush/internal/lsp"
1112 "github.com/charmbracelet/crush/internal/ui/common"
1213 "github.com/charmbracelet/crush/internal/ui/styles"
13− "github.com/charmbracelet/crush/internal/workspace"
1414 "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
1515)
1616
1717// LSPInfo wraps LSP client information with diagnostic counts by severity.
1818type LSPInfo struct {
19− workspace.LSPClientInfo
19+ app.LSPClientInfo
2020 Diagnostics map[protocol.DiagnosticSeverity]int
2121}
2222
@@ -25,7 +25,7 @@ type LSPInfo struct {
2525func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
2626 t := m.com.Styles
2727
28− states := slices.SortedFunc(maps.Values(m.lspStates), func(a, b workspace.LSPClientInfo) int {
28+ states := slices.SortedFunc(maps.Values(m.lspStates), func(a, b app.LSPClientInfo) int {
2929 return strings.Compare(a.Name, b.Name)
3030 })
3131
internal/ui/model/ui.go+5−4
@@ -28,6 +28,7 @@ import (
2828 "github.com/charmbracelet/crush/internal/agent/notify"
2929 agenttools "github.com/charmbracelet/crush/internal/agent/tools"
3030 "github.com/charmbracelet/crush/internal/agent/tools/mcp"
31+ "github.com/charmbracelet/crush/internal/app"
3132 "github.com/charmbracelet/crush/internal/commands"
3233 "github.com/charmbracelet/crush/internal/config"
3334 "github.com/charmbracelet/crush/internal/fsext"
@@ -213,7 +214,7 @@ type UI struct {
213214 }
214215
215216 // lsp
216− lspStates map[string]workspace.LSPClientInfo
217+ lspStates map[string]app.LSPClientInfo
217218
218219 // mcp
219220 mcpStates map[string]mcp.ClientInfo
@@ -315,7 +316,7 @@ func New(com *common.Common, initialSessionID string, continueLast bool) *UI {
315316 completions: comp,
316317 attachments: attachments,
317318 todoSpinner: todoSpinner,
318− lspStates: make(map[string]workspace.LSPClientInfo),
319+ lspStates: make(map[string]app.LSPClientInfo),
319320 mcpStates: make(map[string]mcp.ClientInfo),
320321 notifyBackend: notification.NoopBackend{},
321322 notifyWindowFocused: true,
@@ -615,8 +616,8 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
615616 m.renderPills()
616617 case pubsub.Event[history.File]:
617618 cmds = append(cmds, m.handleFileEvent(msg.Payload))
618− case pubsub.Event[workspace.LSPEvent]:
619− m.lspStates = m.com.Workspace.LSPGetStates()
619+ case pubsub.Event[app.LSPEvent]:
620+ m.lspStates = app.GetLSPStates()
620621 case pubsub.Event[mcp.Event]:
621622 switch msg.Payload.Type {
622623 case mcp.EventStateChanged: