Skip to content

Commit

Permalink
Use updated vim.diagnostic API to avoid deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dstein64 committed May 17, 2024
1 parent 796c1e5 commit 9257c3f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/scrollview/signs/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ function M.init(enable)
if not scrollview.is_sign_group_active(group) then return end
for _, winid in ipairs(scrollview.get_sign_eligible_windows()) do
local bufnr = api.nvim_win_get_buf(winid)
if vim.diagnostic.is_disabled(bufnr) then
local diagnostics_enabled
-- vim.diagnostic.is_disabled was deprecated in Neovim v0.10.
if vim.diagnostic.is_enabled ~= nil then
diagnostics_enabled = vim.diagnostic.is_enabled({bufnr = bufnr})
else
diagnostics_enabled = not vim.diagnostic.is_disabled(bufnr)
end
if not diagnostics_enabled then
for _, name in pairs(names) do
-- luacheck: ignore 122 (setting read-only field b.?.? of global vim)
vim.b[bufnr][name] = {}
Expand Down

0 comments on commit 9257c3f

Please sign in to comment.