mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
feat(diagnostics): add vim.diagnostic.get_namespaces (#15866)
Many vim.diagnostic functions expect the user to pass in a namespace id.
This PR allows the user to list active diagnostic namespaces:
```lua
:lua print(vim.inspect(vim.diagnostic.get_namespaces()))
{
[7] = {
name = "vim.lsp.client-1",
opts = {},
sign_group = "vim.diagnostic.vim.lsp.client-1"
}
}
```
This commit is contained in:
committed by
GitHub
parent
36408146ad
commit
724ffe7095
@@ -646,6 +646,13 @@ function M.set(namespace, bufnr, diagnostics, opts)
|
||||
vim.api.nvim_command("doautocmd <nomodeline> User DiagnosticsChanged")
|
||||
end
|
||||
|
||||
--- Get current diagnostic namespaces.
|
||||
---
|
||||
---@return table A list of active diagnostic namespaces |vim.diagnostic|.
|
||||
function M.get_namespaces()
|
||||
return vim.deepcopy(all_namespaces)
|
||||
end
|
||||
|
||||
--- Get current diagnostics.
|
||||
---
|
||||
---@param bufnr number|nil Buffer number to get diagnostics from. Use 0 for
|
||||
|
||||
Reference in New Issue
Block a user