Skip to content

Commit

Permalink
fix: better weak handling
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 22, 2023
1 parent cd3802a commit af39d61
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/lazy/core/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,14 @@ function Spec:warn(msg)
end

function Spec:fix_disabled()
---@param plugin LazyPlugin
local function all_weak(plugin)
return (not plugin) or (rawget(plugin, "weak") and all_weak(plugin._.super))
end

-- handle weak plugins
for _, plugin in pairs(self.plugins) do
if plugin.weak and not plugin._.super then
if plugin.weak and all_weak(plugin) then
self.plugins[plugin.name] = nil
end
end
Expand Down

0 comments on commit af39d61

Please sign in to comment.