@@ -5,6 +5,7 @@ import (
55 "log/slog"
66 "os/exec"
77 "slices"
8+ "sync"
89 "time"
910
1011 "github.com/charmbracelet/crush/internal/config"
@@ -58,16 +59,25 @@ func (app *App) initLSPClients(ctx context.Context) {
5859 updateLSPState(name, lsp.StateDisabled, nil, nil, 0)
5960 }
6061 }
62+
63+ var wg sync.WaitGroup
6164 for name, server := range filtered {
6265 if app.config.Options.AutoLSP != nil && !*app.config.Options.AutoLSP && !slices.Contains(userConfiguredLSPs, name) {
6366 slog.Debug("Ignoring non user-define LSP client due to AutoLSP being disabled", "name", name)
6467 continue
6568 }
66− go app.createAndStartLSPClient(
67− ctx, name,
68− toOurConfig(server),
69− slices.Contains(userConfiguredLSPs, name),
70− )
69+ wg.Go(func() {
70+ app.createAndStartLSPClient(
71+ ctx, name,
72+ toOurConfig(server),
73+ slices.Contains(userConfiguredLSPs, name),
74+ )
75+ })
76+ }
77+ wg.Wait()
78+
79+ if err := app.AgentCoordinator.UpdateModels(ctx); err != nil {
80+ slog.Error("Failed to refresh tools after LSP startup", "error", err)
7181 }
7282}
7383