@@ -31,26 +31,23 @@ func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
32 var lsps []LSPInfo
32 var lsps []LSPInfo
33 for _, state := range states {
33 for _, state := range states {
34+ lspErrs := map[protocol.DiagnosticSeverity]int{}
34− client, ok := m.com.App.LSPManager.Clients().Get(state.Name)
35+ if client, ok := m.com.App.LSPManager.Clients().Get(state.Name); ok {
38− counts := client.GetDiagnosticCounts()
36+ counts := client.GetDiagnosticCounts()
39− lspErrs := map[protocol.DiagnosticSeverity]int{
40− protocol.SeverityError: counts.Error,
37+ lspErrs[protocol.SeverityError] = counts.Error
41− protocol.SeverityWarning: counts.Warning,
38+ lspErrs[protocol.SeverityWarning] = counts.Warning
42− protocol.SeverityHint: counts.Hint,
39+ lspErrs[protocol.SeverityHint] = counts.Hint
43− protocol.SeverityInformation: counts.Information,
40+ lspErrs[protocol.SeverityInformation] = counts.Information
46 lsps = append(lsps, LSPInfo{LSPClientInfo: state, Diagnostics: lspErrs})
43 lsps = append(lsps, LSPInfo{LSPClientInfo: state, Diagnostics: lspErrs})
49− title := t.Subtle.Render("LSPs")
46+ title := t.ResourceGroupTitle.Render("LSPs")
50 if isSection {
47 if isSection {
51 title = common.Section(t, title, width)
48 title = common.Section(t, title, width)
53− list := t.Subtle.Render("None")
50+ list := t.ResourceAdditionalText.Render("None")
54 if len(lsps) > 0 {
51 if len(lsps) > 0 {
55 list = lspList(t, lsps, width, maxItems)
52 list = lspList(t, lsps, width, maxItems)
@@ -85,30 +82,33 @@ func lspList(t *styles.Styles, lsps []LSPInfo, width, maxItems int) string {
85 var renderedLsps []string
82 var renderedLsps []string
86 for _, l := range lsps {
83 for _, l := range lsps {
87 var icon string
84 var icon string
88− title := l.Name
85+ title := t.ResourceName.Render(l.Name)
89 var description string
86 var description string
90 var diagnostics string
87 var diagnostics string
91 switch l.State {
88 switch l.State {
89+ case lsp.StateUnstarted:
90+ icon = t.ResourceOfflineIcon.String()
91+ description = t.ResourceStatus.Render("unstarted")
92 case lsp.StateStopped:
92 case lsp.StateStopped:
93− icon = t.ItemOfflineIcon.Foreground(t.Muted.GetBackground()).String()
93+ icon = t.ResourceOfflineIcon.String()
94− description = t.Subtle.Render("stopped")
94+ description = t.ResourceStatus.Render("stopped")
95 case lsp.StateStarting:
95 case lsp.StateStarting:
96− icon = t.ItemBusyIcon.String()
96+ icon = t.ResourceBusyIcon.String()
97− description = t.Subtle.Render("starting...")
97+ description = t.ResourceStatus.Render("starting...")
98 case lsp.StateReady:
98 case lsp.StateReady:
99− icon = t.ItemOnlineIcon.String()
99+ icon = t.ResourceOnlineIcon.String()
100 diagnostics = lspDiagnostics(t, l.Diagnostics)
100 diagnostics = lspDiagnostics(t, l.Diagnostics)
101 case lsp.StateError:
101 case lsp.StateError:
102− icon = t.ItemErrorIcon.String()
102+ icon = t.ResourceErrorIcon.String()
103− description = t.Subtle.Render("error")
103+ description = t.ResourceStatus.Render("error")
104 if l.Error != nil {
104 if l.Error != nil {
105− description = t.Subtle.Render(fmt.Sprintf("error: %s", l.Error.Error()))
105+ description = t.ResourceStatus.Render(fmt.Sprintf("error: %s", l.Error.Error()))
107 case lsp.StateDisabled:
107 case lsp.StateDisabled:
108− icon = t.ItemOfflineIcon.Foreground(t.Muted.GetBackground()).String()
108+ icon = t.ResourceOfflineIcon.Foreground(t.Muted.GetBackground()).String()
109− description = t.Subtle.Render("disabled")
109+ description = t.ResourceStatus.Render("disabled")
111− icon = t.ItemOfflineIcon.String()
111+ icon = t.ResourceOfflineIcon.String()
113 renderedLsps = append(renderedLsps, common.Status(t, common.StatusOpts{
113 renderedLsps = append(renderedLsps, common.Status(t, common.StatusOpts{
114 Icon: icon,
114 Icon: icon,
@@ -121,7 +121,7 @@ func lspList(t *styles.Styles, lsps []LSPInfo, width, maxItems int) string {
121 if len(renderedLsps) > maxItems {
121 if len(renderedLsps) > maxItems {
122 visibleItems := renderedLsps[:maxItems-1]
122 visibleItems := renderedLsps[:maxItems-1]
123 remaining := len(renderedLsps) - maxItems
123 remaining := len(renderedLsps) - maxItems
124− visibleItems = append(visibleItems, t.Subtle.Render(fmt.Sprintf("…and %d more", remaining)))
124+ visibleItems = append(visibleItems, t.ResourceAdditionalText.Render(fmt.Sprintf("…and %d more", remaining)))
125 return lipgloss.JoinVertical(lipgloss.Left, visibleItems...)
125 return lipgloss.JoinVertical(lipgloss.Left, visibleItems...)
127 return lipgloss.JoinVertical(lipgloss.Left, renderedLsps...)
127 return lipgloss.JoinVertical(lipgloss.Left, renderedLsps...)