feat(toggle-diagnostics): change logic based on vim.diagnostic.is_disabled

After discussion in #2215, I thought maybe it would be beneficial if we
could change the logic of the `toggle-diagnostics` function based on if
the user has disabled diagnostics in his own configuration.
This commit is contained in:
Iordanis Petkakis 2023-12-19 12:39:28 +02:00
parent 879e29504d
commit 88e75615b1

View file

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