mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
lsp: Change diagnosticg.get_all to return {bufnr: Diagnostic[]} (#13310)
Allows users to associate the diagnostics with the right bufnr.
This commit is contained in:
committed by
GitHub
parent
5c7141cc71
commit
f5e0f17968
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user