mirror of https://github.com/folke/lazy.nvim.git
fix(loader): add proper error message when trying to load a plugin that doesn't exist. Fixes #160
This commit is contained in:
parent
e632eb4ae0
commit
90952239d2
|
@ -110,10 +110,20 @@ function M.load(plugins, reason)
|
|||
---@cast plugins (string|LazyPlugin)[]
|
||||
|
||||
for _, plugin in pairs(plugins) do
|
||||
plugin = type(plugin) == "string" and Config.plugins[plugin] or plugin
|
||||
local try_load = true
|
||||
|
||||
if type(plugin) == "string" then
|
||||
if not Config.plugins[plugin] then
|
||||
Util.error("Plugin " .. plugin .. " not found")
|
||||
try_load = false
|
||||
else
|
||||
plugin = Config.plugins[plugin]
|
||||
end
|
||||
end
|
||||
|
||||
---@cast plugin LazyPlugin
|
||||
|
||||
if not plugin._.loaded then
|
||||
if try_load and not plugin._.loaded then
|
||||
---@diagnostic disable-next-line: assign-type-mismatch
|
||||
plugin._.loaded = {}
|
||||
for k, v in pairs(reason) do
|
||||
|
@ -137,7 +147,9 @@ function M.load(plugins, reason)
|
|||
end
|
||||
|
||||
if plugin.dependencies then
|
||||
Util.try(function()
|
||||
M.load(plugin.dependencies, {})
|
||||
end, "Failed to load deps for " .. plugin.name)
|
||||
end
|
||||
|
||||
M.packadd(plugin.dir)
|
||||
|
|
Loading…
Reference in New Issue