From 199e1004647895d5cb87911ae65e4f01418abf3b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 27 May 2023 08:45:14 +0200 Subject: [PATCH] fix(plugin): delay check if plugin ref exists until after loading all plugins. Fixes #833 --- lua/lazy/core/plugin.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index eb132d3..f3e87a6 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -130,9 +130,6 @@ function Spec:add(plugin, results, is_dep) plugin.dependencies = plugin.dependencies and self:normalize(plugin.dependencies, {}, true) or nil if self.plugins[plugin.name] then plugin = self:merge(self.plugins[plugin.name], plugin) - elseif is_ref and not plugin.url then - self:error("Plugin spec for **" .. plugin.name .. "** not found.\n```lua\n" .. vim.inspect(plugin) .. "\n```") - return end self.plugins[plugin.name] = plugin if results then @@ -150,6 +147,12 @@ function Spec:warn(msg) end function Spec:fix_disabled() + for _, plugin in pairs(self.plugins) do + if not plugin.url or not plugin.dir then + self:error("Plugin spec for **" .. plugin.name .. "** not found.\n```lua\n" .. vim.inspect(plugin) .. "\n```") + self.plugins[plugin.name] = nil + end + end if not self.optional then ---@param plugin LazyPlugin local function all_optional(plugin)