mirror of
https://github.com/neovim/neovim.git
synced 2025-11-14 06:18:50 +00:00
feat(diagnostic)!: make DiagnosticChanged a first class autocmd (#16098)
This allows users to hook into diagnostic events with finer granularity (e.g. per-buffer or file). BREAKING CHANGE: DiagnosticsChanged and LspDiagnosticsChanged user autocommands are removed.
This commit is contained in:
@@ -671,12 +671,14 @@ function M.set(namespace, bufnr, diagnostics, opts)
|
||||
M.show(namespace, bufnr, diagnostics, opts)
|
||||
end
|
||||
|
||||
vim.api.nvim_command("doautocmd <nomodeline> User DiagnosticsChanged")
|
||||
vim.api.nvim_command(
|
||||
string.format("doautocmd <nomodeline> DiagnosticChanged %s", vim.api.nvim_buf_get_name(bufnr))
|
||||
)
|
||||
end
|
||||
|
||||
--- Get namespace metadata.
|
||||
---
|
||||
---@param ns number Diagnostic namespace
|
||||
---@param namespace number Diagnostic namespace
|
||||
---@return table Namespace metadata
|
||||
function M.get_namespace(namespace)
|
||||
vim.validate { namespace = { namespace, 'n' } }
|
||||
@@ -1331,7 +1333,9 @@ function M.reset(namespace, bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_command("doautocmd <nomodeline> User DiagnosticsChanged")
|
||||
vim.api.nvim_command(
|
||||
string.format("doautocmd <nomodeline> DiagnosticChanged %s", vim.api.nvim_buf_get_name(bufnr))
|
||||
)
|
||||
end
|
||||
|
||||
--- Add all diagnostics to the quickfix list.
|
||||
|
||||
Reference in New Issue
Block a user