From 88e75615b1dbe77ce674349b40102a54a8de6a57 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis Date: Tue, 19 Dec 2023 12:39:28 +0200 Subject: [PATCH] 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. --- lua/lazyvim/util/toggle.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index db41c825..225560fd 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -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