fix(diagnostic): set effective buffer number for DiagnosticChanged autocmd (#16474)

This enables use of <abuf> in autocommand handlers for
DiagnosticChanged.
This commit is contained in:
Gregory Anders 2021-12-01 07:27:17 -07:00 committed by GitHub
parent d3585e0ec5
commit 99f6260f84

View File

@ -653,9 +653,11 @@ function M.set(namespace, bufnr, diagnostics, opts)
M.show(namespace, bufnr, nil, opts)
end
vim.api.nvim_command(
string.format("doautocmd <nomodeline> DiagnosticChanged %s", vim.api.nvim_buf_get_name(bufnr))
)
vim.api.nvim_buf_call(bufnr, function()
vim.api.nvim_command(
string.format("doautocmd <nomodeline> DiagnosticChanged %s", vim.api.nvim_buf_get_name(bufnr))
)
end)
end
--- Get namespace metadata.