mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -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 diagnostic_ns number|nil Associated diagnostic namespace
|
||||||
---@param sign_ns number|nil Associated sign namespace
|
---@param sign_ns number|nil Associated sign namespace
|
||||||
function M.clear(bufnr, client_id, diagnostic_ns, sign_ns)
|
function M.clear(bufnr, client_id, diagnostic_ns, sign_ns)
|
||||||
validate { bufnr = { bufnr, 'n' } }
|
bufnr = get_bufnr(bufnr)
|
||||||
|
|
||||||
bufnr = (bufnr == 0 and api.nvim_get_current_buf()) or bufnr
|
|
||||||
|
|
||||||
if client_id == nil then
|
if client_id == nil then
|
||||||
return vim.lsp.for_each_buffer_client(bufnr, function(_, iter_client_id, _)
|
return vim.lsp.for_each_buffer_client(bufnr, function(_, iter_client_id, _)
|
||||||
return M.clear(bufnr, iter_client_id)
|
return M.clear(bufnr, iter_client_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user