refactor(handlers): lazy resolving of plugin handlers (#1126)

* refactor(handlers): lazy resolving of plugin handlers

* test: fixed tests
This commit is contained in:
Folke Lemaitre 2023-10-16 22:34:44 +02:00 committed by GitHub
parent b9c604e839
commit 2f169e74d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 126 additions and 120 deletions

View file

@ -37,7 +37,7 @@ M.group = vim.api.nvim_create_augroup("lazy_handler_event", { clear = true })
---@param spec LazyEventSpec
---@return LazyEvent
function M:parse(spec)
function M:_parse(spec)
local ret = M.mappings[spec] --[[@as LazyEvent?]]
if ret then
return ret
@ -62,19 +62,6 @@ function M:parse(spec)
return ret
end
---@param plugin LazyPlugin
function M:values(plugin)
local Plugin = require("lazy.core.plugin")
---@type table<string,any>
local values = {}
---@diagnostic disable-next-line: no-unknown
for _, value in ipairs(Plugin.values(plugin, self.type, true)) do
local event = self:parse(value)
values[event.id] = event
end
return values
end
---@param event LazyEvent
function M:_add(event)
local done = false