@@ -31,26 +31,23 @@ func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
3131
3232 var lsps []LSPInfo
3333 for _, state := range states {
34− client, ok := m.com.App.LSPManager.Clients().Get(state.Name)
35− if !ok {
36− continue
37− }
38− counts := client.GetDiagnosticCounts()
39− lspErrs := map[protocol.DiagnosticSeverity]int{
40− protocol.SeverityError: counts.Error,
41− protocol.SeverityWarning: counts.Warning,
42− protocol.SeverityHint: counts.Hint,
43− protocol.SeverityInformation: counts.Information,
34+ lspErrs := map[protocol.DiagnosticSeverity]int{}
35+ if client, ok := m.com.App.LSPManager.Clients().Get(state.Name); ok {
36+ counts := client.GetDiagnosticCounts()
37+ lspErrs[protocol.SeverityError] = counts.Error
38+ lspErrs[protocol.SeverityWarning] = counts.Warning
39+ lspErrs[protocol.SeverityHint] = counts.Hint
40+ lspErrs[protocol.SeverityInformation] = counts.Information
4441 }
4542
4643 lsps = append(lsps, LSPInfo{LSPClientInfo: state, Diagnostics: lspErrs})
4744 }
4845
49− title := t.Subtle.Render("LSPs")
46+ title := t.ResourceGroupTitle.Render("LSPs")
5047 if isSection {
5148 title = common.Section(t, title, width)
5249 }
53− list := t.Subtle.Render("None")
50+ list := t.ResourceAdditionalText.Render("None")
5451 if len(lsps) > 0 {
5552 list = lspList(t, lsps, width, maxItems)
5653 }
@@ -85,30 +82,33 @@ func lspList(t *styles.Styles, lsps []LSPInfo, width, maxItems int) string {
8582 var renderedLsps []string
8683 for _, l := range lsps {
8784 var icon string
88− title := l.Name
85+ title := t.ResourceName.Render(l.Name)
8986 var description string
9087 var diagnostics string
9188 switch l.State {
89+ case lsp.StateUnstarted:
90+ icon = t.ResourceOfflineIcon.String()
91+ description = t.ResourceStatus.Render("unstarted")
9292 case lsp.StateStopped:
93− icon = t.ItemOfflineIcon.Foreground(t.Muted.GetBackground()).String()
94− description = t.Subtle.Render("stopped")
93+ icon = t.ResourceOfflineIcon.String()
94+ description = t.ResourceStatus.Render("stopped")
9595 case lsp.StateStarting:
96− icon = t.ItemBusyIcon.String()
97− description = t.Subtle.Render("starting...")
96+ icon = t.ResourceBusyIcon.String()
97+ description = t.ResourceStatus.Render("starting...")
9898 case lsp.StateReady:
99− icon = t.ItemOnlineIcon.String()
99+ icon = t.ResourceOnlineIcon.String()
100100 diagnostics = lspDiagnostics(t, l.Diagnostics)
101101 case lsp.StateError:
102− icon = t.ItemErrorIcon.String()
103− description = t.Subtle.Render("error")
102+ icon = t.ResourceErrorIcon.String()
103+ description = t.ResourceStatus.Render("error")
104104 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()))
106106 }
107107 case lsp.StateDisabled:
108− icon = t.ItemOfflineIcon.Foreground(t.Muted.GetBackground()).String()
109− description = t.Subtle.Render("disabled")
108+ icon = t.ResourceOfflineIcon.Foreground(t.Muted.GetBackground()).String()
109+ description = t.ResourceStatus.Render("disabled")
110110 default:
111− icon = t.ItemOfflineIcon.String()
111+ icon = t.ResourceOfflineIcon.String()
112112 }
113113 renderedLsps = append(renderedLsps, common.Status(t, common.StatusOpts{
114114 Icon: icon,
@@ -121,7 +121,7 @@ func lspList(t *styles.Styles, lsps []LSPInfo, width, maxItems int) string {
121121 if len(renderedLsps) > maxItems {
122122 visibleItems := renderedLsps[:maxItems-1]
123123 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)))
125125 return lipgloss.JoinVertical(lipgloss.Left, visibleItems...)
126126 }
127127 return lipgloss.JoinVertical(lipgloss.Left, renderedLsps...)