mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-28 11:24:14 +00:00
Add healthcheck warning for spec lists where keys will be ignored
This commit is contained in:
parent
aedcd79811
commit
b18b60cd45
1 changed files with 19 additions and 2 deletions
|
@ -355,9 +355,26 @@ function Spec:normalize(spec, results)
|
||||||
end
|
end
|
||||||
elseif #spec > 1 or Util.is_list(spec) then
|
elseif #spec > 1 or Util.is_list(spec) then
|
||||||
---@cast spec LazySpec[]
|
---@cast spec LazySpec[]
|
||||||
for _, s in ipairs(spec) do
|
local ignored_keys = {}
|
||||||
|
local ignored_keys_exist = false
|
||||||
|
for k, s in pairs(spec) do
|
||||||
|
if type(k) ~= "number" then
|
||||||
|
-- in cases of {'foo', opts = {}, 'bar'} and similar
|
||||||
|
ignored_keys[k] = s
|
||||||
|
ignored_keys_exist = true
|
||||||
|
else
|
||||||
self:normalize(s, results)
|
self:normalize(s, results)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
if ignored_keys_exist then
|
||||||
|
-- HACK: Uses hashing order to insert the warning after integer keys, but before the rest of LazySpec's string keys
|
||||||
|
spec["WARNING:"] = "-- Ignored keys below! --"
|
||||||
|
self:warn(
|
||||||
|
"This list of specs has extraneous keys - these will not be processed by lazy.nvim as they do not belong to any plugins: "
|
||||||
|
.. vim.inspect(spec, { depth = 2, process = processor })
|
||||||
|
.. "\n"
|
||||||
|
)
|
||||||
|
end
|
||||||
elseif spec[1] or spec.dir or spec.url then
|
elseif spec[1] or spec.dir or spec.url then
|
||||||
---@cast spec LazyPlugin
|
---@cast spec LazyPlugin
|
||||||
local plugin = self:add(spec, results)
|
local plugin = self:add(spec, results)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue