From 016335a7d09fca82cd6065ca4f54101c27249d01 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Mon, 1 Dec 2025 08:56:25 +0800 Subject: feat(lsp): support refreshing workspace diagnostics --- runtime/lua/vim/lsp/diagnostic.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index 9b62cbc55f..80c3501467 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -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 -- cgit