fix(lsp): attach reused multi-root client outside state lock

This commit is contained in:
NanPan
2026-09-16 19:37:39 +08:00
committed by Teknium
parent 0d941c53c8
commit 6950959fa5

View File

@@ -389,12 +389,15 @@ class LSPService:
client = self._clients.get(key)
if client is not None and client.is_running:
self._last_used[key] = time.time()
eventlog.log_active(srv.server_id, root)
return await self._attach_root(srv, client, root)
spawning = self._spawning.get(key)
owner = spawning is None
if owner:
spawning = self._spawning[key] = asyncio.get_running_loop().create_future()
else:
client = None
spawning = self._spawning.get(key)
owner = spawning is None
if owner:
spawning = self._spawning[key] = asyncio.get_running_loop().create_future()
if client is not None:
eventlog.log_active(srv.server_id, root)
return await self._attach_root(srv, client, root)
if not owner:
try:
client = await spawning