fix(toggle): use vim.diagnostics enabled state when possible

This commit is contained in:
Folke Lemaitre 2024-01-21 20:40:11 +01:00
parent 2c067f8003
commit 3cbfeab718
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -41,9 +41,15 @@ function M.number()
end
end
local enabled = not vim.diagnostic.is_disabled()
local enabled = true
function M.diagnostics()
-- if this Neovim version supports checking if diagnostics are enabled
-- then use that for the current state
if vim.diagnostic.is_disabled then
enabled = not vim.diagnostic.is_disabled()
end
enabled = not enabled
if enabled then
vim.diagnostic.enable()
Util.info("Enabled diagnostics", { title = "Diagnostics" })