fix(toggle): use vim.diagnostic.is_disabled()

use `vim.diagnostic.is_disabled()` instad of local variable `enable` to tracking diagnostic status.
This commit is contained in:
konosubakonoakua 2024-01-03 20:03:30 +08:00
parent 879e29504d
commit d39c6867a8

View file

@ -41,10 +41,8 @@ function M.number()
end
end
local enabled = true
function M.diagnostics()
enabled = not enabled
if enabled then
if vim.diagnostic.is_disabled() then
vim.diagnostic.enable()
Util.info("Enabled diagnostics", { title = "Diagnostics" })
else