diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index 840a343..c53ee72 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -49,6 +49,7 @@ end -- PERF: optimized code to get package name without using lua patterns function Spec.get_name(pkg) local name = pkg:sub(-4) == ".git" and pkg:sub(1, -5) or pkg + name = name:sub(-1) == "/" and name:sub(1, -2) or name local slash = name:reverse():find("/", 1, true) --[[@as number?]] return slash and name:sub(#name - slash + 2) or pkg:gsub("%W+", "_") end @@ -109,6 +110,11 @@ function Spec:add(plugin, results, is_dep) return end + if not plugin.name or plugin.name == "" then + self:error("Plugin spec " .. vim.inspect(plugin) .. " has no name") + return + end + if type(plugin.config) == "table" then self:warn( "{" .. plugin.name .. "}: setting a table to `Plugin.config` is deprecated. Please use `Plugin.opts` instead"