on main help sign in
fix: lsp sort
f002e6fKujtim Hoxha
internal/ui/model/lsp.go+8−1
@@ -23,8 +23,14 @@ type LSPInfo struct {
23func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
23func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
24 var lsps []LSPInfo
24 var lsps []LSPInfo
25 t := m.com.Styles
25 t := m.com.Styles
26+ lspConfigs := m.com.Config().LSP.Sorted()
27+
28+ for _, cfg := range lspConfigs {
29+ state, ok := m.lspStates[cfg.Name]
30+ if !ok {
31+ continue
32+ }
26
33
27− for _, state := range m.lspStates {
28 client, ok := m.com.App.LSPClients.Get(state.Name)
34 client, ok := m.com.App.LSPClients.Get(state.Name)
29 if !ok {
35 if !ok {
30 continue
36 continue
@@ -39,6 +45,7 @@ func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
39
45
40 lsps = append(lsps, LSPInfo{LSPClientInfo: state, Diagnostics: lspErrs})
46 lsps = append(lsps, LSPInfo{LSPClientInfo: state, Diagnostics: lspErrs})
41 }
47 }
48+
42 title := t.Subtle.Render("LSPs")
49 title := t.Subtle.Render("LSPs")
43 if isSection {
50 if isSection {
44 title = common.Section(t, title, width)
51 title = common.Section(t, title, width)
internal/ui/model/ui.go+2
@@ -265,6 +265,8 @@ func New(com *common.Common) *UI {
265 completions: comp,
265 completions: comp,
266 attachments: attachments,
266 attachments: attachments,
267 todoSpinner: todoSpinner,
267 todoSpinner: todoSpinner,
268+ lspStates: make(map[string]app.LSPClientInfo),
269+ mcpStates: make(map[string]mcp.ClientInfo),
268 }
270 }
269
271
270 status := NewStatus(com, ui)
272 status := NewStatus(com, ui)