refactor: replace deprecated use of vim.diagnostic.is_disabled() (#2781)

* Deprecation fix

* Deprecation fix

* remove unnecessary assignment

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Zachary Rizer 2024-05-25 00:42:34 -04:00 committed by GitHub
parent 2bc725a3eb
commit 4215f33da5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,12 +39,14 @@ end
local function from_nvim_lsp() local function from_nvim_lsp()
local buffer_severity = {} local buffer_severity = {}
local is_disabled = false local is_enabled
if vim.fn.has "nvim-0.9" == 1 then if vim.fn.has "nvim-0.10" == 1 then
is_disabled = vim.diagnostic.is_disabled() is_enabled = vim.diagnostic.is_enabled()
else
is_enabled = not vim.diagnostic.is_disabled()
end end
if not is_disabled then if is_enabled then
for _, diagnostic in ipairs(vim.diagnostic.get(nil, { severity = M.severity })) do for _, diagnostic in ipairs(vim.diagnostic.get(nil, { severity = M.severity })) do
local buf = diagnostic.bufnr local buf = diagnostic.bufnr
if vim.api.nvim_buf_is_valid(buf) then if vim.api.nvim_buf_is_valid(buf) then