mirror of https://github.com/folke/lazy.nvim.git
fix(meta): only tag new top-level pkg fragment as optional
This commit is contained in:
parent
aff7ee8e89
commit
25981e1f39
|
@ -34,14 +34,17 @@ function M:load_pkgs()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for _, pkg in ipairs(Pkg.get()) do
|
for _, pkg in ipairs(Pkg.get()) do
|
||||||
|
local last_id = self.fragments._fid
|
||||||
local meta, fragment = self:add(pkg.spec)
|
local meta, fragment = self:add(pkg.spec)
|
||||||
if meta and fragment then
|
if meta and fragment then
|
||||||
meta._.pkg = pkg
|
meta._.pkg = pkg
|
||||||
-- tag all package fragments as optional
|
-- tag all top-level package fragments that were added as optional
|
||||||
for _, fid in ipairs(meta._.frags) do
|
for _, fid in ipairs(meta._.frags) do
|
||||||
|
if fid > last_id then
|
||||||
local frag = self.fragments:get(fid)
|
local frag = self.fragments:get(fid)
|
||||||
frag.spec.optional = true
|
frag.spec.optional = true
|
||||||
end
|
end
|
||||||
|
end
|
||||||
-- keep track of the top-level package fragment
|
-- keep track of the top-level package fragment
|
||||||
self.pkgs[pkg.dir] = fragment.id
|
self.pkgs[pkg.dir] = fragment.id
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue