on main help sign in
fix(ui): show auto-discovered LSPs (#2077)
514318dJames Trew
internal/ui/model/lsp.go+7−7
@@ -2,6 +2,8 @@ package model
2
2
3import (
3import (
4 "fmt"
4 "fmt"
5+ "maps"
6+ "slices"
5 "strings"
7 "strings"
6
8
7 "charm.land/lipgloss/v2"
9 "charm.land/lipgloss/v2"
@@ -21,16 +23,14 @@ type LSPInfo struct {
21// lspInfo renders the LSP status section showing active LSP clients and their
23// lspInfo renders the LSP status section showing active LSP clients and their
22// diagnostic counts.
24// diagnostic counts.
23func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
25func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
24− var lsps []LSPInfo
25 t := m.com.Styles
26 t := m.com.Styles
26− lspConfigs := m.com.Config().LSP.Sorted()
27
27
28− for _, cfg := range lspConfigs {
28+ states := slices.SortedFunc(maps.Values(m.lspStates), func(a, b app.LSPClientInfo) int {
29− state, ok := m.lspStates[cfg.Name]
29+ return strings.Compare(a.Name, b.Name)
30− if !ok {
31− continue
32− }
30+ })
33
31
32+ var lsps []LSPInfo
33+ for _, state := range states {
34 client, ok := m.com.App.LSPClients.Get(state.Name)
34 client, ok := m.com.App.LSPClients.Get(state.Name)
35 if !ok {
35 if !ok {
36 continue
36 continue