mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
fix(toggle): use vim.diagnostics enabled state when possible
This commit is contained in:
parent
2c067f8003
commit
3cbfeab718
1 changed files with 7 additions and 1 deletions
|
|
@ -41,9 +41,15 @@ function M.number()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local enabled = not vim.diagnostic.is_disabled()
|
local enabled = true
|
||||||
function M.diagnostics()
|
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
|
enabled = not enabled
|
||||||
|
|
||||||
if enabled then
|
if enabled then
|
||||||
vim.diagnostic.enable()
|
vim.diagnostic.enable()
|
||||||
Util.info("Enabled diagnostics", { title = "Diagnostics" })
|
Util.info("Enabled diagnostics", { title = "Diagnostics" })
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue