on main help sign in
fix: shifting LSPs and MCPs in sidebar
0dbefd1Christian Rocha
internal/tui/components/chat/sidebar/sidebar.go+11−11
@@ -332,7 +332,7 @@ func (m *sidebarCmp) lspBlock() string {
332
332
333 lspList := []string{section, ""}
333 lspList := []string{section, ""}
334
334
335− lsp := config.Get().LSP
335+ lsp := config.Get().LSP.Sorted()
336 if len(lsp) == 0 {
336 if len(lsp) == 0 {
337 return lipgloss.JoinVertical(
337 return lipgloss.JoinVertical(
338 lipgloss.Left,
338 lipgloss.Left,
@@ -342,9 +342,9 @@ func (m *sidebarCmp) lspBlock() string {
342 )
342 )
343 }
343 }
344
344
345− for n, l := range lsp {
345+ for _, l := range lsp {
346 iconColor := t.Success
346 iconColor := t.Success
347− if l.Disabled {
347+ if l.LSP.Disabled {
348 iconColor = t.FgMuted
348 iconColor = t.FgMuted
349 }
349 }
350 lspErrs := map[protocol.DiagnosticSeverity]int{
350 lspErrs := map[protocol.DiagnosticSeverity]int{
@@ -353,7 +353,7 @@ func (m *sidebarCmp) lspBlock() string {
353 protocol.SeverityHint: 0,
353 protocol.SeverityHint: 0,
354 protocol.SeverityInformation: 0,
354 protocol.SeverityInformation: 0,
355 }
355 }
356− if client, ok := m.lspClients[n]; ok {
356+ if client, ok := m.lspClients[l.Name]; ok {
357 for _, diagnostics := range client.GetDiagnostics() {
357 for _, diagnostics := range client.GetDiagnostics() {
358 for _, diagnostic := range diagnostics {
358 for _, diagnostic := range diagnostics {
359 if severity, ok := lspErrs[diagnostic.Severity]; ok {
359 if severity, ok := lspErrs[diagnostic.Severity]; ok {
@@ -381,8 +381,8 @@ func (m *sidebarCmp) lspBlock() string {
381 core.Status(
381 core.Status(
382 core.StatusOpts{
382 core.StatusOpts{
383 IconColor: iconColor,
383 IconColor: iconColor,
384− Title: n,
384+ Title: l.Name,
385− Description: l.Command,
385+ Description: l.LSP.Command,
386 ExtraContent: strings.Join(errs, " "),
386 ExtraContent: strings.Join(errs, " "),
387 },
387 },
388 m.width,
388 m.width,
@@ -406,8 +406,8 @@ func (m *sidebarCmp) mcpBlock() string {
406
406
407 mcpList := []string{section, ""}
407 mcpList := []string{section, ""}
408
408
409− mcp := config.Get().MCP
409+ mcps := config.Get().MCP.Sorted()
410− if len(mcp) == 0 {
410+ if len(mcps) == 0 {
411 return lipgloss.JoinVertical(
411 return lipgloss.JoinVertical(
412 lipgloss.Left,
412 lipgloss.Left,
413 section,
413 section,
@@ -416,14 +416,14 @@ func (m *sidebarCmp) mcpBlock() string {
416 )
416 )
417 }
417 }
418
418
419− for n, l := range mcp {
419+ for _, l := range mcps {
420 iconColor := t.Success
420 iconColor := t.Success
421 mcpList = append(mcpList,
421 mcpList = append(mcpList,
422 core.Status(
422 core.Status(
423 core.StatusOpts{
423 core.StatusOpts{
424 IconColor: iconColor,
424 IconColor: iconColor,
425− Title: n,
425+ Title: l.Name,
426− Description: l.Command,
426+ Description: l.MCP.Command,
427 },
427 },
428 m.width,
428 m.width,
429 ),
429 ),