mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
fix(lsp): allow diagnostic.clear to accept nil bufnr (#15137)
Passing `nil` is equivalent to passing 0, i.e. it simply uses the current buffer number. This fixes a bug when vim.lsp.diagnostic.disable() is called without arguments.
This commit is contained in:
parent
223c355040
commit
4ed2d4fd66
@ -819,10 +819,7 @@ end
|
||||
---@param diagnostic_ns number|nil Associated diagnostic namespace
|
||||
---@param sign_ns number|nil Associated sign namespace
|
||||
function M.clear(bufnr, client_id, diagnostic_ns, sign_ns)
|
||||
validate { bufnr = { bufnr, 'n' } }
|
||||
|
||||
bufnr = (bufnr == 0 and api.nvim_get_current_buf()) or bufnr
|
||||
|
||||
bufnr = get_bufnr(bufnr)
|
||||
if client_id == nil then
|
||||
return vim.lsp.for_each_buffer_client(bufnr, function(_, iter_client_id, _)
|
||||
return M.clear(bufnr, iter_client_id)
|
||||
|
Loading…
Reference in New Issue
Block a user