mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-30 04:24:35 +02:00
feat(toggle): use vim.diagnostic.is_disabled
when available (#2217)
* 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. * feat(toggle-diagnostics): revert to `enable` instead of `status` * fix(toggle): use vim.diagnostics enabled state when possible --------- Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
This commit is contained in:
parent
a43d8cf358
commit
93342f15ba
1 changed files with 6 additions and 0 deletions
|
@ -43,7 +43,13 @@ end
|
||||||
|
|
||||||
local enabled = true
|
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
Add a link
Reference in a new issue