Skip to content

Commit

Permalink
fix: use non-deprecated versions of vim.validate
Browse files Browse the repository at this point in the history
This will remove stack traces from `:checkhealth vim.deprecated`.
  • Loading branch information
dundargoc authored and lewis6991 committed Feb 5, 2025
1 parent cf1ffe6 commit 0883d0f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/gitsigns/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,15 @@ M.schema = {
},
}

local function validate(k, v, ty)
if vim.fn.has('nvim-0.11') == 1 then
--- @diagnostic disable-next-line: redundant-parameter,param-type-mismatch
vim.validate(k, v, ty)
else
vim.validate({ [k] = { v, ty } })
end
end

--- @param config Gitsigns.Config
local function validate_config(config)
for k, v in
Expand All @@ -904,7 +913,7 @@ local function validate_config(config)
else
local ty = kschema.type
if type(ty) == 'string' or type(ty) == 'function' then
vim.validate({ [k] = { v, ty } })
validate(k, v, ty)
end
end
end
Expand Down

0 comments on commit 0883d0f

Please sign in to comment.