mirror of
https://github.com/sst/opencode.git
synced 2025-08-22 22:14:14 +00:00
fix: if lsp fails to spawn it shouldn't inject errors into edit diagnostics (#2145)
This commit is contained in:
parent
947a3e8aff
commit
aa4dba1541
1 changed files with 6 additions and 2 deletions
|
@ -126,7 +126,11 @@ export namespace LSP {
|
||||||
result.push(match)
|
result.push(match)
|
||||||
continue
|
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
|
if (!handle) continue
|
||||||
const client = await LSPClient.create({
|
const client = await LSPClient.create({
|
||||||
serverID: server.id,
|
serverID: server.id,
|
||||||
|
@ -135,7 +139,7 @@ export namespace LSP {
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
s.broken.add(root + server.id)
|
s.broken.add(root + server.id)
|
||||||
handle.process.kill()
|
handle.process.kill()
|
||||||
log.error("", { error: err })
|
log.error(`Failed to initialize LSP client ${server.id}`, { error: err })
|
||||||
})
|
})
|
||||||
if (!client) continue
|
if (!client) continue
|
||||||
s.clients.push(client)
|
s.clients.push(client)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue