on main help sign in
fix(server): show LSP status in client-server mode
f98791eChristian Rocha
internal/ui/model/lsp.go+3−3
@@ -7,16 +7,16 @@ import (
7 "strings"
7 "strings"
8
8
9 "charm.land/lipgloss/v2"
9 "charm.land/lipgloss/v2"
10− "github.com/charmbracelet/crush/internal/app"
11 "github.com/charmbracelet/crush/internal/lsp"
10 "github.com/charmbracelet/crush/internal/lsp"
12 "github.com/charmbracelet/crush/internal/ui/common"
11 "github.com/charmbracelet/crush/internal/ui/common"
13 "github.com/charmbracelet/crush/internal/ui/styles"
12 "github.com/charmbracelet/crush/internal/ui/styles"
13+ "github.com/charmbracelet/crush/internal/workspace"
14 "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
14 "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
15)
15)
16
16
17// LSPInfo wraps LSP client information with diagnostic counts by severity.
17// LSPInfo wraps LSP client information with diagnostic counts by severity.
18type LSPInfo struct {
18type LSPInfo struct {
19− app.LSPClientInfo
19+ workspace.LSPClientInfo
20 Diagnostics map[protocol.DiagnosticSeverity]int
20 Diagnostics map[protocol.DiagnosticSeverity]int
21}
21}
22
22
@@ -25,7 +25,7 @@ type LSPInfo struct {
25func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
25func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
26 t := m.com.Styles
26 t := m.com.Styles
27
27
28− states := slices.SortedFunc(maps.Values(m.lspStates), func(a, b app.LSPClientInfo) int {
28+ states := slices.SortedFunc(maps.Values(m.lspStates), func(a, b workspace.LSPClientInfo) int {
29 return strings.Compare(a.Name, b.Name)
29 return strings.Compare(a.Name, b.Name)
30 })
30 })
31
31
internal/ui/model/ui.go+5−3
@@ -227,7 +227,7 @@ type UI struct {
227 }
227 }
228
228
229 // lsp
229 // lsp
230− lspStates map[string]app.LSPClientInfo
230+ lspStates map[string]workspace.LSPClientInfo
231
231
232 // mcp
232 // mcp
233 mcpStates map[string]mcp.ClientInfo
233 mcpStates map[string]mcp.ClientInfo
@@ -337,7 +337,7 @@ func New(com *common.Common, initialSessionID string, continueLast bool) *UI {
337 completions: comp,
337 completions: comp,
338 attachments: attachments,
338 attachments: attachments,
339 todoSpinner: todoSpinner,
339 todoSpinner: todoSpinner,
340− lspStates: make(map[string]app.LSPClientInfo),
340+ lspStates: make(map[string]workspace.LSPClientInfo),
341 mcpStates: make(map[string]mcp.ClientInfo),
341 mcpStates: make(map[string]mcp.ClientInfo),
342 notifyBackend: notification.NoopBackend{},
342 notifyBackend: notification.NoopBackend{},
343 notifyWindowFocused: true,
343 notifyWindowFocused: true,
@@ -707,7 +707,9 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
707 case pubsub.Event[history.File]:
707 case pubsub.Event[history.File]:
708 cmds = append(cmds, m.handleFileEvent(msg.Payload))
708 cmds = append(cmds, m.handleFileEvent(msg.Payload))
709 case pubsub.Event[app.LSPEvent]:
709 case pubsub.Event[app.LSPEvent]:
710− m.lspStates = app.GetLSPStates()
710+ m.lspStates = m.com.Workspace.LSPGetStates()
711+ case pubsub.Event[workspace.LSPEvent]:
712+ m.lspStates = m.com.Workspace.LSPGetStates()
711 case pubsub.Event[skills.Event]:
713 case pubsub.Event[skills.Event]:
712 m.skillStates = msg.Payload.States
714 m.skillStates = msg.Payload.States
713 case pubsub.Event[mcp.Event]:
715 case pubsub.Event[mcp.Event]: