fix(lsp): store result id for unchanged diagnostic reports

**Problem:** For unchanged document diagnostic reports, the `resultId`
is ignored completely, even though it should still be saved for the
request (in fact, the spec marks it as mandatory for unchanged reports,
so it should be extra important).

**Solution:** Always store the `resultId`.
This commit is contained in:
Riley Bruins
2025-07-08 18:03:52 -07:00
parent ea2d226df6
commit 1d8e9b5d07
2 changed files with 34 additions and 3 deletions

View File

@@ -269,16 +269,20 @@ function M.on_diagnostic(error, result, ctx)
return
end
if result == nil or result.kind == 'unchanged' then
if result == nil then
return
end
local client_id = ctx.client_id
handle_diagnostics(ctx.params.textDocument.uri, client_id, result.items, true)
local bufnr = assert(ctx.bufnr)
local bufstate = bufstates[bufnr]
bufstate.client_result_id[client_id] = result.resultId
if result.kind == 'unchanged' then
return
end
handle_diagnostics(ctx.params.textDocument.uri, client_id, result.items, true)
end
--- Clear push diagnostics and diagnostic cache.