diff options
author | Mathias Fußenegger <mfussenegger@users.noreply.github.com> | 2020-12-03 20:22:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 14:22:15 -0500 |
commit | f5e0f17968eae6770cc0da136d8c9a4b23bc6da2 (patch) | |
tree | 0c4b90d830c7472e90a642b1d259b3834e5867dd /runtime/lua/vim/lsp/diagnostic.lua | |
parent | 5c7141cc710030b1bf77dd524cfcfb0947b58a4c (diff) | |
download | rneovim-f5e0f17968eae6770cc0da136d8c9a4b23bc6da2.tar.gz rneovim-f5e0f17968eae6770cc0da136d8c9a4b23bc6da2.tar.bz2 rneovim-f5e0f17968eae6770cc0da136d8c9a4b23bc6da2.zip |
lsp: Change diagnosticg.get_all to return {bufnr: Diagnostic[]} (#13310)
Allows users to associate the diagnostics with the right bufnr.
Diffstat (limited to 'runtime/lua/vim/lsp/diagnostic.lua')
-rw-r--r-- | runtime/lua/vim/lsp/diagnostic.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index 1570d4a122..27a1f53f89 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -308,15 +308,16 @@ end --- Get all diagnostics for all clients --- ----@return Diagnostic[] +---@return {bufnr: Diagnostic[]} function M.get_all() - local all_diagnostics = {} - for _, buf_diagnostics in pairs(diagnostic_cache) do + local diagnostics_by_bufnr = {} + for bufnr, buf_diagnostics in pairs(diagnostic_cache) do + diagnostics_by_bufnr[bufnr] = {} for _, client_diagnostics in pairs(buf_diagnostics) do - vim.list_extend(all_diagnostics, client_diagnostics) + vim.list_extend(diagnostics_by_bufnr[bufnr], client_diagnostics) end end - return all_diagnostics + return diagnostics_by_bufnr end --- Return associated diagnostics for bufnr |