nvim: use vim.diagnostic.is_enabled() instead of deprecated vim.diagnostic.is_disabled()

This commit is contained in:
Fernando Schauenburg 2025-03-25 20:29:36 +01:00
parent 75b544e352
commit ff894c77a0

View file

@ -42,11 +42,11 @@ M.open_float = function(opts) vim.diagnostic.open_float(opts) end
---Toggle diagnostics in the given buffer.
---@param bufnr integer|nil: Buffer number (0 for current buffer, nil for all buffers.
M.toggle = function(bufnr)
bufnr = bufnr or 0
if vim.diagnostic.is_disabled(bufnr) then
vim.diagnostic.enable(bufnr)
local filter = { bufnr = bufnr or 0 }
if vim.diagnostic.is_enabled(filter) then
vim.diagnostic.enable(false, filter)
else
vim.diagnostic.disable(bufnr)
vim.diagnostic.enable(true, filter)
end
end