Skip to content

Commit

Permalink
fix(plugin): rename weak => optional. Makes more sense :)
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 22, 2023
1 parent 8cd4a59 commit 9177778
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lua/lazy/core/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ 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))
local function all_optional(plugin)
return (not plugin) or (rawget(plugin, "optional") and all_optional(plugin._.super))
end

-- handle weak plugins
-- handle optional plugins
for _, plugin in pairs(self.plugins) do
if plugin.weak and all_weak(plugin) then
if plugin.optional and all_optional(plugin) then
self.plugins[plugin.name] = nil
end
end
Expand Down
2 changes: 1 addition & 1 deletion lua/lazy/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
---@field dir string
---@field enabled? boolean|(fun():boolean)
---@field cond? boolean|(fun():boolean)
---@field weak? boolean If set, then this plugin will not be added unless it is added somewhere else
---@field optional? boolean If set, then this plugin will not be added unless it is added somewhere else
---@field lazy? boolean
---@field priority? number Only useful for lazy=false plugins to force loading certain plugins first. Default priority is 50
---@field dev? boolean If set, then link to the respective folder under your ~/projects
Expand Down

0 comments on commit 9177778

Please sign in to comment.