feat(lsp): support refreshing workspace diagnostics

This commit is contained in:
Pig Fang
2025-12-01 08:56:25 +08:00
committed by Lewis Russell
parent a7c21f4b17
commit 016335a7d0
2 changed files with 58 additions and 3 deletions

View File

@@ -395,9 +395,17 @@ function M.on_refresh(err, _, ctx)
if err then
return vim.NIL
end
for bufnr in pairs(vim.lsp.get_client_by_id(ctx.client_id).attached_buffers or {}) do
if bufstates[bufnr] and bufstates[bufnr].pull_kind == 'document' then
refresh(bufnr)
local client = vim.lsp.get_client_by_id(ctx.client_id)
if
client.server_capabilities.diagnosticProvider
and client.server_capabilities.diagnosticProvider.workspaceDiagnostics
then
M._workspace_diagnostics(ctx)
else
for bufnr in pairs(client.attached_buffers or {}) do
if bufstates[bufnr] and bufstates[bufnr].pull_kind == 'document' then
refresh(bufnr)
end
end
end