mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
fix(toggle): make diagnostics compatible with nvim-0.9.5
This commit is contained in:
parent
12818a6cb4
commit
9d0b43d175
1 changed files with 25 additions and 2 deletions
|
|
@ -127,9 +127,32 @@ M.number = M.wrap({
|
||||||
M.diagnostics = M.wrap({
|
M.diagnostics = M.wrap({
|
||||||
name = "Diagnostics",
|
name = "Diagnostics",
|
||||||
get = function()
|
get = function()
|
||||||
return vim.diagnostic.is_enabled and vim.diagnostic.is_enabled()
|
local enabled
|
||||||
|
if vim.diagnostic.is_enabled then
|
||||||
|
enabled = vim.diagnostic.is_enabled()
|
||||||
|
else
|
||||||
|
enabled = not vim.diagnostic.is_disabled()
|
||||||
|
end
|
||||||
|
return enabled
|
||||||
|
end,
|
||||||
|
set = function()
|
||||||
|
local enabled
|
||||||
|
if vim.diagnostic.is_enabled then
|
||||||
|
enabled = vim.diagnostic.is_enabled()
|
||||||
|
else
|
||||||
|
enabled = not vim.diagnostic.is_disabled()
|
||||||
|
end
|
||||||
|
enabled = not enabled
|
||||||
|
if vim.fn.has("nvim-0.10") == 0 then
|
||||||
|
if enabled then
|
||||||
|
pcall(vim.diagnostic.enable)
|
||||||
|
else
|
||||||
|
vim.diagnostic.disable()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
vim.diagnostic.enable(enabled)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
set = vim.diagnostic.enable,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
M.inlay_hints = M.wrap({
|
M.inlay_hints = M.wrap({
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue