@@ -5,17 +5,14 @@ import (
8− "github.com/charmbracelet/crush/internal/config"
9 "github.com/charmbracelet/crush/internal/log"
8 "github.com/charmbracelet/crush/internal/log"
10 "github.com/charmbracelet/crush/internal/lsp"
9 "github.com/charmbracelet/crush/internal/lsp"
11 "github.com/charmbracelet/crush/internal/lsp/watcher"
10 "github.com/charmbracelet/crush/internal/lsp/watcher"
14func (app *App) initLSPClients(ctx context.Context) {
13func (app *App) initLSPClients(ctx context.Context) {
17 // Initialize LSP clients
14 // Initialize LSP clients
18− for name, clientConfig := range cfg.LSP {
15+ for name, clientConfig := range app.config.LSP {
19 // Start each client initialization in its own goroutine
16 // Start each client initialization in its own goroutine
20 go app.createAndStartLSPClient(ctx, name, clientConfig.Command, clientConfig.Args...)
17 go app.createAndStartLSPClient(ctx, name, clientConfig.Command, clientConfig.Args...)
@@ -39,7 +36,7 @@ func (app *App) createAndStartLSPClient(ctx context.Context, name string, comman
39 defer cancel()
36 defer cancel()
41 // Initialize with the initialization context
38 // Initialize with the initialization context
42− _, err = lspClient.InitializeLSPClient(initCtx, config.Get().WorkingDir())
39+ _, err = lspClient.InitializeLSPClient(initCtx, app.config.WorkingDir())
43 if err != nil {
40 if err != nil {
44 slog.Error("Initialize failed", "name", name, "error", err)
41 slog.Error("Initialize failed", "name", name, "error", err)
45 // Clean up the client to prevent resource leaks
42 // Clean up the client to prevent resource leaks
@@ -92,15 +89,14 @@ func (app *App) runWorkspaceWatcher(ctx context.Context, name string, workspaceW
92 app.restartLSPClient(ctx, name)
89 app.restartLSPClient(ctx, name)
95− workspaceWatcher.WatchWorkspace(ctx, config.Get().WorkingDir())
92+ workspaceWatcher.WatchWorkspace(ctx, app.config.WorkingDir())
96 slog.Info("Workspace watcher stopped", "client", name)
93 slog.Info("Workspace watcher stopped", "client", name)
99// restartLSPClient attempts to restart a crashed or failed LSP client
96// restartLSPClient attempts to restart a crashed or failed LSP client
100func (app *App) restartLSPClient(ctx context.Context, name string) {
97func (app *App) restartLSPClient(ctx context.Context, name string) {
101 // Get the original configuration
98 // Get the original configuration
103− clientConfig, exists := cfg.LSP[name]
99+ clientConfig, exists := app.config.LSP[name]
104 if !exists {
100 if !exists {
105 slog.Error("Cannot restart client, configuration not found", "client", name)
101 slog.Error("Cannot restart client, configuration not found", "client", name)