2022-11-25 21:48:17 +00:00
|
|
|
local Config = require("lazy.core.config")
|
|
|
|
local Util = require("lazy.core.util")
|
2022-11-29 18:58:23 +00:00
|
|
|
local Handler = require("lazy.core.handler")
|
2022-12-16 14:08:09 +00:00
|
|
|
local Cache = require("lazy.core.cache")
|
2022-11-25 21:48:17 +00:00
|
|
|
|
2022-12-28 16:57:59 +00:00
|
|
|
---@class LazyCorePlugin
|
2022-11-25 21:48:17 +00:00
|
|
|
local M = {}
|
|
|
|
|
2023-01-04 08:35:00 +00:00
|
|
|
local list_merge = { "dependencies" }
|
|
|
|
vim.list_extend(list_merge, vim.tbl_values(Handler.types))
|
|
|
|
|
2022-11-28 06:36:32 +00:00
|
|
|
---@class LazySpecLoader
|
2022-11-25 21:48:17 +00:00
|
|
|
---@field plugins table<string, LazyPlugin>
|
2023-01-03 09:34:53 +00:00
|
|
|
---@field disabled table<string, LazyPlugin>
|
2023-01-01 20:07:05 +00:00
|
|
|
---@field modules string[]
|
2023-01-02 08:44:09 +00:00
|
|
|
---@field notifs {msg:string, level:number, file?:string}[]
|
|
|
|
---@field importing? string
|
2022-11-25 21:48:17 +00:00
|
|
|
local Spec = {}
|
2022-11-29 13:27:58 +00:00
|
|
|
M.Spec = Spec
|
|
|
|
|
|
|
|
---@param spec? LazySpec
|
2023-01-02 08:44:09 +00:00
|
|
|
function Spec.new(spec)
|
2022-11-29 13:27:58 +00:00
|
|
|
local self = setmetatable({}, { __index = Spec })
|
|
|
|
self.plugins = {}
|
2023-01-03 09:34:53 +00:00
|
|
|
self.disabled = {}
|
2023-01-01 20:07:05 +00:00
|
|
|
self.modules = {}
|
2023-01-02 08:44:09 +00:00
|
|
|
self.notifs = {}
|
2022-11-29 13:27:58 +00:00
|
|
|
if spec then
|
|
|
|
self:normalize(spec)
|
|
|
|
end
|
|
|
|
return self
|
|
|
|
end
|
2022-11-25 21:48:17 +00:00
|
|
|
|
2022-12-13 09:09:33 +00:00
|
|
|
-- 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
|
|
|
|
local slash = name:reverse():find("/", 1, true) --[[@as number?]]
|
|
|
|
return slash and name:sub(#name - slash + 2) or pkg:gsub("%W+", "_")
|
|
|
|
end
|
|
|
|
|
2022-11-25 21:48:17 +00:00
|
|
|
---@param plugin LazyPlugin
|
2023-01-03 09:34:53 +00:00
|
|
|
---@param results? string[]
|
2022-11-29 18:51:37 +00:00
|
|
|
---@param is_dep? boolean
|
2023-01-03 09:34:53 +00:00
|
|
|
function Spec:add(plugin, results, is_dep)
|
|
|
|
-- check if we already processed this spec. Can happen when a user uses the same instance of a spec in multiple specs
|
|
|
|
-- see https://github.com/folke/lazy.nvim/issues/45
|
|
|
|
if plugin._ then
|
2023-01-04 16:50:57 +00:00
|
|
|
if results then
|
|
|
|
table.insert(results, plugin.name)
|
|
|
|
end
|
|
|
|
return plugin
|
2023-01-03 09:34:53 +00:00
|
|
|
end
|
|
|
|
|
2022-12-13 09:09:33 +00:00
|
|
|
if not plugin.url and plugin[1] then
|
2023-01-09 12:25:50 +00:00
|
|
|
local prefix = plugin[1]:sub(1, 4)
|
|
|
|
if prefix == "http" or prefix == "git@" then
|
|
|
|
plugin.url = plugin[1]
|
|
|
|
else
|
|
|
|
plugin.url = Config.options.git.url_format:format(plugin[1])
|
|
|
|
end
|
2022-11-25 21:48:17 +00:00
|
|
|
end
|
2022-11-29 13:27:58 +00:00
|
|
|
|
2022-12-13 09:09:33 +00:00
|
|
|
if plugin.dir then
|
2022-12-20 06:19:55 +00:00
|
|
|
plugin.dir = Util.norm(plugin.dir)
|
2022-12-13 09:09:33 +00:00
|
|
|
-- local plugin
|
|
|
|
plugin.name = plugin.name or Spec.get_name(plugin.dir)
|
|
|
|
elseif plugin.url then
|
|
|
|
plugin.name = plugin.name or Spec.get_name(plugin.url)
|
|
|
|
-- check for dev plugins
|
|
|
|
if plugin.dev == nil then
|
|
|
|
for _, pattern in ipairs(Config.options.dev.patterns) do
|
|
|
|
if plugin.url:find(pattern, 1, true) then
|
|
|
|
plugin.dev = true
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- dev plugins
|
|
|
|
if plugin.dev then
|
|
|
|
plugin.dir = Config.options.dev.path .. "/" .. plugin.name
|
2022-11-29 13:27:58 +00:00
|
|
|
else
|
2022-12-13 09:09:33 +00:00
|
|
|
-- remote plugin
|
|
|
|
plugin.dir = Config.options.root .. "/" .. plugin.name
|
2022-11-29 13:27:58 +00:00
|
|
|
end
|
2022-12-13 09:09:33 +00:00
|
|
|
else
|
2022-12-22 15:36:07 +00:00
|
|
|
self:error("Invalid plugin spec " .. vim.inspect(plugin))
|
2023-01-04 16:50:57 +00:00
|
|
|
return
|
2022-11-25 21:48:17 +00:00
|
|
|
end
|
|
|
|
|
2022-12-16 08:13:08 +00:00
|
|
|
plugin.event = type(plugin.event) == "string" and { plugin.event } or plugin.event
|
|
|
|
plugin.keys = type(plugin.keys) == "string" and { plugin.keys } or plugin.keys
|
|
|
|
plugin.cmd = type(plugin.cmd) == "string" and { plugin.cmd } or plugin.cmd
|
|
|
|
plugin.ft = type(plugin.ft) == "string" and { plugin.ft } or plugin.ft
|
|
|
|
|
2023-01-08 14:01:49 +00:00
|
|
|
if type(plugin.config) == "table" then
|
|
|
|
self:warn(
|
|
|
|
"{" .. plugin.name .. "}: setting a table to `Plugin.config` is deprecated. Please use `Plugin.opts` instead"
|
|
|
|
)
|
|
|
|
---@diagnostic disable-next-line: assign-type-mismatch
|
|
|
|
plugin.opts = plugin.config
|
|
|
|
plugin.config = nil
|
|
|
|
end
|
|
|
|
|
2022-12-02 16:09:40 +00:00
|
|
|
plugin._ = {}
|
|
|
|
plugin._.dep = is_dep
|
2022-11-29 18:51:37 +00:00
|
|
|
|
2023-01-04 09:36:51 +00:00
|
|
|
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)
|
2023-01-03 09:34:53 +00:00
|
|
|
end
|
2023-01-04 09:36:51 +00:00
|
|
|
self.plugins[plugin.name] = plugin
|
2023-01-04 16:50:57 +00:00
|
|
|
if results then
|
|
|
|
table.insert(results, plugin.name)
|
|
|
|
end
|
|
|
|
return plugin
|
2022-11-25 21:48:17 +00:00
|
|
|
end
|
|
|
|
|
2023-01-02 08:44:09 +00:00
|
|
|
function Spec:error(msg)
|
2023-01-02 09:08:45 +00:00
|
|
|
self:log(msg, vim.log.levels.ERROR)
|
2023-01-02 08:44:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function Spec:warn(msg)
|
2023-01-02 09:08:45 +00:00
|
|
|
self:log(msg, vim.log.levels.WARN)
|
2023-01-02 08:44:09 +00:00
|
|
|
end
|
|
|
|
|
2023-01-04 09:36:51 +00:00
|
|
|
function Spec:fix_disabled()
|
|
|
|
---@type table<string,string[]> plugin to parent plugin
|
|
|
|
local dep_of = {}
|
|
|
|
|
|
|
|
---@type string[] dependencies of disabled plugins
|
|
|
|
local disabled_deps = {}
|
|
|
|
|
|
|
|
for _, plugin in pairs(self.plugins) do
|
|
|
|
local enabled = not (plugin.enabled == false or (type(plugin.enabled) == "function" and not plugin.enabled()))
|
|
|
|
if enabled then
|
|
|
|
for _, dep in ipairs(plugin.dependencies or {}) do
|
|
|
|
dep_of[dep] = dep_of[dep] or {}
|
|
|
|
table.insert(dep_of[dep], plugin.name)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
plugin._.kind = "disabled"
|
|
|
|
self.plugins[plugin.name] = nil
|
|
|
|
self.disabled[plugin.name] = plugin
|
|
|
|
if plugin.dependencies then
|
|
|
|
vim.list_extend(disabled_deps, plugin.dependencies)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- check deps of disabled plugins
|
|
|
|
for _, dep in ipairs(disabled_deps) do
|
|
|
|
-- only check if the plugin is still enabled and it is a dep
|
|
|
|
if self.plugins[dep] and self.plugins[dep]._.dep then
|
|
|
|
-- check if the dep is still used by another plugin
|
|
|
|
local keep = false
|
|
|
|
for _, parent in ipairs(dep_of[dep] or {}) do
|
|
|
|
if self.plugins[parent] then
|
|
|
|
keep = true
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- disable the dep when no longer needed
|
|
|
|
if not keep then
|
|
|
|
local plugin = self.plugins[dep]
|
|
|
|
plugin._.kind = "disabled"
|
|
|
|
self.plugins[plugin.name] = nil
|
|
|
|
self.disabled[plugin.name] = plugin
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-01-02 08:44:09 +00:00
|
|
|
---@param msg string
|
|
|
|
---@param level number
|
2023-01-02 09:08:45 +00:00
|
|
|
function Spec:log(msg, level)
|
2023-01-02 08:44:09 +00:00
|
|
|
self.notifs[#self.notifs + 1] = { msg = msg, level = level, file = self.importing }
|
2023-01-02 09:08:45 +00:00
|
|
|
end
|
|
|
|
|
2023-01-02 11:53:35 +00:00
|
|
|
function Spec:report(level)
|
|
|
|
level = level or vim.log.levels.ERROR
|
2023-01-02 09:08:45 +00:00
|
|
|
for _, notif in ipairs(self.notifs) do
|
2023-01-02 11:53:35 +00:00
|
|
|
if notif.level >= level then
|
2023-01-10 07:42:20 +00:00
|
|
|
Util.notify(notif.msg, { level = notif.level })
|
2023-01-02 11:53:35 +00:00
|
|
|
end
|
2023-01-02 09:08:45 +00:00
|
|
|
end
|
2022-12-22 15:36:07 +00:00
|
|
|
end
|
|
|
|
|
2023-01-01 20:07:05 +00:00
|
|
|
---@param spec LazySpec|LazySpecImport
|
2022-11-25 21:48:17 +00:00
|
|
|
---@param results? string[]
|
2022-11-29 18:51:37 +00:00
|
|
|
---@param is_dep? boolean
|
|
|
|
function Spec:normalize(spec, results, is_dep)
|
2022-11-25 21:48:17 +00:00
|
|
|
if type(spec) == "string" then
|
2022-12-22 15:36:07 +00:00
|
|
|
if is_dep and not spec:find("/", 1, true) then
|
|
|
|
-- spec is a plugin name
|
2023-01-03 09:34:53 +00:00
|
|
|
if results then
|
|
|
|
table.insert(results, spec)
|
|
|
|
end
|
2022-12-22 15:36:07 +00:00
|
|
|
else
|
2023-01-03 09:34:53 +00:00
|
|
|
self:add({ spec }, results, is_dep)
|
2022-12-22 15:36:07 +00:00
|
|
|
end
|
2022-11-25 21:48:17 +00:00
|
|
|
elseif #spec > 1 or Util.is_list(spec) then
|
2022-11-28 06:36:32 +00:00
|
|
|
---@cast spec LazySpec[]
|
2022-11-25 21:48:17 +00:00
|
|
|
for _, s in ipairs(spec) do
|
2022-11-29 18:51:37 +00:00
|
|
|
self:normalize(s, results, is_dep)
|
2022-11-25 21:48:17 +00:00
|
|
|
end
|
2023-01-04 16:50:57 +00:00
|
|
|
elseif spec[1] or spec.dir or spec.url then
|
|
|
|
---@cast spec LazyPlugin
|
|
|
|
local plugin = self:add(spec, results, is_dep)
|
|
|
|
---@diagnostic disable-next-line: cast-type-mismatch
|
|
|
|
---@cast plugin LazySpecImport
|
|
|
|
if plugin and plugin.import then
|
|
|
|
self:import(plugin)
|
|
|
|
end
|
2023-01-01 20:07:05 +00:00
|
|
|
elseif spec.import then
|
|
|
|
---@cast spec LazySpecImport
|
|
|
|
self:import(spec)
|
|
|
|
else
|
2023-01-04 16:50:57 +00:00
|
|
|
self:error("Invalid plugin spec " .. vim.inspect(spec))
|
2022-11-25 21:48:17 +00:00
|
|
|
end
|
|
|
|
return results
|
|
|
|
end
|
|
|
|
|
2023-01-01 20:07:05 +00:00
|
|
|
---@param spec LazySpecImport
|
|
|
|
function Spec:import(spec)
|
2023-01-03 21:49:04 +00:00
|
|
|
if spec.import == "lazy" then
|
|
|
|
return self:error("You can't name your plugins module `lazy`.")
|
|
|
|
end
|
2023-01-10 08:20:39 +00:00
|
|
|
if vim.tbl_contains(self.modules, spec.import) then
|
|
|
|
return
|
|
|
|
end
|
2023-01-01 20:07:05 +00:00
|
|
|
if spec.enabled == false or (type(spec.enabled) == "function" and not spec.enabled()) then
|
|
|
|
return
|
|
|
|
end
|
2023-01-02 08:44:09 +00:00
|
|
|
|
|
|
|
Cache.indexed_unloaded = false
|
2023-01-02 11:53:35 +00:00
|
|
|
self.modules[#self.modules + 1] = spec.import
|
2023-01-02 08:44:09 +00:00
|
|
|
|
|
|
|
local imported = 0
|
2023-01-01 20:07:05 +00:00
|
|
|
Util.lsmod(spec.import, function(modname)
|
2023-01-02 08:44:09 +00:00
|
|
|
imported = imported + 1
|
|
|
|
Util.track({ import = modname })
|
|
|
|
self.importing = modname
|
2023-01-01 20:07:05 +00:00
|
|
|
-- unload the module so we get a clean slate
|
|
|
|
---@diagnostic disable-next-line: no-unknown
|
|
|
|
package.loaded[modname] = nil
|
|
|
|
Util.try(function()
|
2023-01-02 11:53:35 +00:00
|
|
|
self:normalize(require(modname))
|
2023-01-02 08:44:09 +00:00
|
|
|
self.importing = nil
|
|
|
|
Util.track()
|
2023-01-01 20:07:05 +00:00
|
|
|
end, {
|
|
|
|
msg = "Failed to load `" .. modname .. "`",
|
|
|
|
on_error = function(msg)
|
|
|
|
self:error(msg)
|
2023-01-02 08:44:09 +00:00
|
|
|
self.importing = nil
|
|
|
|
Util.track()
|
2023-01-01 20:07:05 +00:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
end)
|
2023-01-02 08:44:09 +00:00
|
|
|
if imported == 0 then
|
|
|
|
self:error("No specs found for module " .. spec.import)
|
|
|
|
end
|
2023-01-01 20:07:05 +00:00
|
|
|
end
|
|
|
|
|
2022-11-29 18:51:37 +00:00
|
|
|
---@param old LazyPlugin
|
|
|
|
---@param new LazyPlugin
|
|
|
|
---@return LazyPlugin
|
2022-11-29 23:18:59 +00:00
|
|
|
function Spec:merge(old, new)
|
2023-01-04 08:35:00 +00:00
|
|
|
new._.dep = old._.dep and new._.dep
|
|
|
|
|
2023-01-07 08:37:03 +00:00
|
|
|
if new.url and old.url and new.url ~= old.url then
|
|
|
|
self:error("Two plugins with the same name and different url:\n" .. vim.inspect({ old = old, new = new }))
|
|
|
|
end
|
|
|
|
|
2023-01-04 08:35:00 +00:00
|
|
|
for _, prop in ipairs(list_merge) do
|
|
|
|
if new[prop] and old[prop] then
|
2023-01-10 06:32:28 +00:00
|
|
|
if new[prop].__merge == nil then
|
|
|
|
new[prop].__merge = true
|
2023-01-04 08:35:00 +00:00
|
|
|
end
|
2023-01-10 06:32:28 +00:00
|
|
|
new[prop] = Util.merge(old[prop], new[prop])
|
2022-11-29 18:51:37 +00:00
|
|
|
end
|
|
|
|
end
|
2023-01-04 08:35:00 +00:00
|
|
|
new._.super = old
|
|
|
|
setmetatable(new, { __index = old })
|
2023-01-10 08:20:39 +00:00
|
|
|
|
2023-01-04 08:35:00 +00:00
|
|
|
return new
|
2022-11-29 18:51:37 +00:00
|
|
|
end
|
|
|
|
|
2022-11-29 23:18:59 +00:00
|
|
|
function M.update_state()
|
2022-12-01 10:06:44 +00:00
|
|
|
---@type table<string,FileType>
|
|
|
|
local installed = {}
|
2022-12-03 14:48:06 +00:00
|
|
|
Util.ls(Config.options.root, function(_, name, type)
|
2022-12-20 06:19:55 +00:00
|
|
|
if type == "directory" and name ~= "readme" then
|
2022-12-01 10:06:44 +00:00
|
|
|
installed[name] = type
|
|
|
|
end
|
|
|
|
end)
|
2022-11-25 21:48:17 +00:00
|
|
|
|
2022-11-29 23:18:59 +00:00
|
|
|
for _, plugin in pairs(Config.plugins) do
|
2022-11-28 10:19:50 +00:00
|
|
|
plugin._ = plugin._ or {}
|
2022-12-01 10:06:44 +00:00
|
|
|
if plugin.lazy == nil then
|
2022-12-02 16:09:40 +00:00
|
|
|
local lazy = plugin._.dep
|
|
|
|
or Config.options.defaults.lazy
|
|
|
|
or plugin.event
|
|
|
|
or plugin.keys
|
|
|
|
or plugin.ft
|
|
|
|
or plugin.cmd
|
2022-12-01 10:06:44 +00:00
|
|
|
plugin.lazy = lazy and true or false
|
2022-11-28 21:03:44 +00:00
|
|
|
end
|
2022-12-20 06:15:26 +00:00
|
|
|
if plugin.dir:find(Config.options.root, 1, true) == 1 then
|
2022-12-03 14:31:21 +00:00
|
|
|
plugin._.installed = installed[plugin.name] ~= nil
|
2022-12-01 10:06:44 +00:00
|
|
|
installed[plugin.name] = nil
|
2022-12-13 09:09:33 +00:00
|
|
|
else
|
|
|
|
plugin._.is_local = true
|
|
|
|
plugin._.installed = true -- local plugins are managed by the user
|
2022-11-28 12:18:31 +00:00
|
|
|
end
|
2022-11-25 21:48:17 +00:00
|
|
|
end
|
|
|
|
|
2022-11-29 23:18:59 +00:00
|
|
|
Config.to_clean = {}
|
2022-12-01 10:06:44 +00:00
|
|
|
for pack, dir_type in pairs(installed) do
|
|
|
|
table.insert(Config.to_clean, {
|
|
|
|
name = pack,
|
2022-12-03 14:48:06 +00:00
|
|
|
dir = Config.options.root .. "/" .. pack,
|
2022-12-01 10:06:44 +00:00
|
|
|
_ = {
|
2022-12-25 20:07:30 +00:00
|
|
|
kind = "clean",
|
2022-12-01 10:06:44 +00:00
|
|
|
installed = true,
|
|
|
|
is_symlink = dir_type == "link",
|
|
|
|
is_local = dir_type == "link",
|
|
|
|
},
|
|
|
|
})
|
2022-11-25 21:48:17 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function M.load()
|
|
|
|
-- load specs
|
2022-11-29 23:18:59 +00:00
|
|
|
Util.track("spec")
|
2023-01-02 08:44:09 +00:00
|
|
|
Config.spec = Spec.new()
|
|
|
|
Config.spec:normalize(vim.deepcopy(Config.options.spec))
|
2022-12-01 15:28:25 +00:00
|
|
|
|
|
|
|
-- add ourselves
|
2023-01-02 08:44:09 +00:00
|
|
|
Config.spec:add({ "folke/lazy.nvim" })
|
2022-12-28 23:49:38 +00:00
|
|
|
-- override some lazy props
|
2023-01-02 08:44:09 +00:00
|
|
|
local lazy = Config.spec.plugins["lazy.nvim"]
|
2023-01-03 09:34:53 +00:00
|
|
|
if lazy then
|
|
|
|
lazy.lazy = true
|
|
|
|
lazy.dir = Config.me
|
|
|
|
lazy.config = function()
|
|
|
|
error("lazy config should not be called")
|
|
|
|
end
|
|
|
|
lazy._.loaded = {}
|
2022-12-28 23:49:38 +00:00
|
|
|
end
|
2023-01-04 09:36:51 +00:00
|
|
|
Config.spec:fix_disabled()
|
2022-12-01 15:28:25 +00:00
|
|
|
|
2022-12-02 16:02:25 +00:00
|
|
|
local existing = Config.plugins
|
2023-01-02 08:44:09 +00:00
|
|
|
Config.plugins = Config.spec.plugins
|
2022-12-02 16:02:25 +00:00
|
|
|
-- copy state. This wont do anything during startup
|
|
|
|
for name, plugin in pairs(existing) do
|
|
|
|
if Config.plugins[name] then
|
|
|
|
Config.plugins[name]._ = plugin._
|
|
|
|
end
|
|
|
|
end
|
2022-11-29 23:18:59 +00:00
|
|
|
Util.track()
|
2022-11-25 21:48:17 +00:00
|
|
|
|
|
|
|
Util.track("state")
|
|
|
|
M.update_state()
|
|
|
|
Util.track()
|
2022-12-28 23:49:38 +00:00
|
|
|
require("lazy.core.cache").indexed_unloaded = false
|
2022-11-25 21:48:17 +00:00
|
|
|
end
|
|
|
|
|
2022-12-02 08:22:15 +00:00
|
|
|
-- Finds the plugin that has this path
|
|
|
|
---@param path string
|
|
|
|
function M.find(path)
|
2023-01-02 13:35:36 +00:00
|
|
|
if not Config.spec then
|
|
|
|
return
|
|
|
|
end
|
2022-12-26 22:41:19 +00:00
|
|
|
local lua = path:find("/lua/", 1, true)
|
2022-12-16 12:06:30 +00:00
|
|
|
if lua then
|
|
|
|
local name = path:sub(1, lua - 1)
|
|
|
|
local slash = name:reverse():find("/", 1, true)
|
|
|
|
if slash then
|
|
|
|
name = name:sub(#name - slash + 2)
|
2023-01-02 14:27:01 +00:00
|
|
|
return name and Config.plugins[name] or Config.spec.plugins[name] or nil
|
2022-12-16 12:06:30 +00:00
|
|
|
end
|
|
|
|
end
|
2022-12-02 08:22:15 +00:00
|
|
|
end
|
|
|
|
|
2023-01-03 21:50:14 +00:00
|
|
|
---@param plugin LazyPlugin
|
|
|
|
function M.has_errors(plugin)
|
|
|
|
for _, task in ipairs(plugin._.tasks or {}) do
|
|
|
|
if task.error then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2022-11-25 21:48:17 +00:00
|
|
|
return M
|