mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-28 11:24:14 +00:00
Remove unused table and cleanup code
This commit is contained in:
parent
9304c37515
commit
76f3da8471
1 changed files with 11 additions and 10 deletions
|
@ -341,12 +341,6 @@ function Spec:report(level)
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
local remove_internal_keys = function(item, path)
|
|
||||||
if path[#path] == "_" then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
return item
|
|
||||||
end
|
|
||||||
---@param spec LazySpec|LazySpecImport
|
---@param spec LazySpec|LazySpecImport
|
||||||
---@param results? string[]
|
---@param results? string[]
|
||||||
function Spec:normalize(spec, results)
|
function Spec:normalize(spec, results)
|
||||||
|
@ -361,12 +355,10 @@ 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[]
|
||||||
local ignored_keys = {}
|
|
||||||
local ignored_keys_exist = false
|
local ignored_keys_exist = false
|
||||||
for k, s in pairs(spec) do
|
for k, s in pairs(spec) do
|
||||||
if type(k) ~= "number" then
|
|
||||||
-- in cases of {'foo', opts = {}, 'bar'} and similar
|
-- in cases of {'foo', opts = {}, 'bar'} and similar
|
||||||
ignored_keys[k] = s
|
if type(k) ~= "number" then
|
||||||
ignored_keys_exist = true
|
ignored_keys_exist = true
|
||||||
else
|
else
|
||||||
self:normalize(s, results)
|
self:normalize(s, results)
|
||||||
|
@ -378,7 +370,16 @@ function Spec:normalize(spec, results)
|
||||||
self:warn(
|
self:warn(
|
||||||
"This list of specs has extraneous keys - "
|
"This list of specs has extraneous keys - "
|
||||||
.. "they do not belong to any plugins, so they are currently unused by lazy.nvim:\n"
|
.. "they do not belong to any plugins, so they are currently unused by lazy.nvim:\n"
|
||||||
.. vim.inspect(spec, { depth = 2, process = remove_internal_keys })
|
.. vim.inspect(spec, {
|
||||||
|
depth = 2,
|
||||||
|
process = function(item, path)
|
||||||
|
-- hide internal lazy.nvim key
|
||||||
|
if path[#path] == "_" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
})
|
||||||
.. "\n"
|
.. "\n"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue