fix(spec): don't import specs more than once

This commit is contained in:
Folke Lemaitre 2023-01-10 09:20:39 +01:00
parent 9fa62ea8ea
commit ad7aafb257
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 4 additions and 0 deletions

View File

@ -225,6 +225,9 @@ function Spec:import(spec)
if spec.import == "lazy" then if spec.import == "lazy" then
return self:error("You can't name your plugins module `lazy`.") return self:error("You can't name your plugins module `lazy`.")
end end
if vim.tbl_contains(self.modules, spec.import) then
return
end
if spec.enabled == false or (type(spec.enabled) == "function" and not spec.enabled()) then if spec.enabled == false or (type(spec.enabled) == "function" and not spec.enabled()) then
return return
end end
@ -278,6 +281,7 @@ function Spec:merge(old, new)
end end
new._.super = old new._.super = old
setmetatable(new, { __index = old }) setmetatable(new, { __index = old })
return new return new
end end