on main help sign in
fix(lsp): properly remove clients from map on stop/kill

- Delete clients from the map in StopAll and KillAll so they can be recreated on restart - Add StateDisabled to the state check to prevent re-initializing disabled clients - Remove duplicate callback invocation in startServer ๐Ÿ’˜ Generated with Crush Assisted-by: Kimi K2.5 via Crush <crush@charm.land>

commit7ac4061b6c8af87e05edbf6bfaa94ded48315545 authorAndrey Nering <andreynering@users.noreply.github.com> dateWed 18 Feb 2026, 14:19 (8 months ago) parenteecb1bf
1 file changed+3โˆ’2
internal/lsp/manager.go+3โˆ’2
internal/lsp/manager.go+3โˆ’2
@@ -201,13 +201,12 @@ func (s *Manager) startServer(ctx context.Context, name, filepath string, server
201201 }()
202202
203203 switch client.GetServerState() {
204โˆ’ case StateReady, StateStarting:
204+ case StateReady, StateStarting, StateDisabled:
205205 // already done, return
206206 return
207207 }
208208
209209 client.serverState.Store(StateStarting)
210โˆ’ s.callback(name, client)
211210
212211 initCtx, cancel := context.WithTimeout(ctx, time.Duration(cmp.Or(cfg.Timeout, 30))*time.Second)
213212 defer cancel()
@@ -315,6 +314,7 @@ func (s *Manager) KillAll(context.Context) {
315314 defer func() { s.callback(name, client) }()
316315 client.client.Kill()
317316 client.SetServerState(StateStopped)
317+ s.clients.Del(name)
318318 slog.Debug("Killed LSP client", "name", name)
319319 })
320320 }
@@ -335,6 +335,7 @@ func (s *Manager) StopAll(ctx context.Context) {
335335 slog.Warn("Failed to stop LSP client", "name", name, "error", err)
336336 }
337337 client.SetServerState(StateStopped)
338+ s.clients.Del(name)
338339 slog.Debug("Stopped LSP client", "name", name)
339340 })
340341 }