fix: if lsp fails to spawn it shouldn't inject errors into edit diagnostics (#2145)

This commit is contained in:
Aiden Cline 2025-08-21 12:06:32 -05:00 committed by GitHub
parent 947a3e8aff
commit aa4dba1541
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,7 +126,11 @@ export namespace LSP {
result.push(match)
continue
}
const handle = await server.spawn(App.info(), root)
const handle = await server.spawn(App.info(), root).catch((err) => {
s.broken.add(root + server.id)
log.error(`Failed to spawn LSP server ${server.id}`, { error: err })
return undefined
})
if (!handle) continue
const client = await LSPClient.create({
serverID: server.id,
@ -135,7 +139,7 @@ export namespace LSP {
}).catch((err) => {
s.broken.add(root + server.id)
handle.process.kill()
log.error("", { error: err })
log.error(`Failed to initialize LSP client ${server.id}`, { error: err })
})
if (!client) continue
s.clients.push(client)