refactor(#2787): replace deprecated

This commit is contained in:
Alexander Courtis 2024-06-01 16:52:50 +10:00
parent c7add15dd4
commit b6b4c32fcb

View file

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