diff options
| author | Pig Fang <g-plane@hotmail.com> | 2025-12-01 08:56:25 +0800 |
|---|---|---|
| committer | Lewis Russell <me@lewisr.dev> | 2025-12-05 15:51:46 +0000 |
| commit | 016335a7d09fca82cd6065ca4f54101c27249d01 (patch) | |
| tree | a05f028238908d28bb78d12bc1f451f3cdc16436 /runtime/lua/vim | |
| parent | a7c21f4b177a68c246ffcfc627d3302626a5b94a (diff) | |
| download | rneovim-016335a7d09fca82cd6065ca4f54101c27249d01.tar.gz rneovim-016335a7d09fca82cd6065ca4f54101c27249d01.tar.bz2 rneovim-016335a7d09fca82cd6065ca4f54101c27249d01.zip | |
feat(lsp): support refreshing workspace diagnostics
Diffstat (limited to 'runtime/lua/vim')
| -rw-r--r-- | runtime/lua/vim/lsp/diagnostic.lua | 14 |
1 files changed, 11 insertions, 3 deletions
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 |