mirror of https://github.com/folke/lazy.nvim.git
refactor: Handler.load => Handler.resolve
This commit is contained in:
parent
03419f3e5f
commit
c059eece0c
|
@ -48,7 +48,7 @@ end
|
|||
function M.enable(plugin)
|
||||
if not plugin._.loaded then
|
||||
if not plugin._.handlers then
|
||||
M.load(plugin)
|
||||
M.resolve(plugin)
|
||||
end
|
||||
for type in pairs(plugin._.handlers or {}) do
|
||||
M.handlers[type]:add(plugin)
|
||||
|
@ -98,7 +98,7 @@ function M:_values(values, plugin)
|
|||
end
|
||||
|
||||
---@param plugin LazyPlugin
|
||||
function M.load(plugin)
|
||||
function M.resolve(plugin)
|
||||
local Plugin = require("lazy.core.plugin")
|
||||
plugin._.handlers = {}
|
||||
for type, handler in pairs(M.handlers) do
|
||||
|
|
|
@ -241,7 +241,7 @@ describe("plugin spec opt", function()
|
|||
local spec = Plugin.Spec.new(test)
|
||||
assert(#spec.notifs == 0)
|
||||
assert(vim.tbl_count(spec.plugins) == 1)
|
||||
Handler.load(spec.plugins.bar)
|
||||
Handler.resolve(spec.plugins.bar)
|
||||
vim.print(spec.plugins.bar._.handlers)
|
||||
local events = vim.tbl_keys(spec.plugins.bar._.handlers.event or {})
|
||||
assert(type(events) == "table")
|
||||
|
@ -307,7 +307,7 @@ describe("plugin spec opt", function()
|
|||
local spec = Plugin.Spec.new(test)
|
||||
assert(#spec.notifs == 0)
|
||||
assert(vim.tbl_count(spec.plugins) == 1)
|
||||
Handler.load(spec.plugins.bar)
|
||||
Handler.resolve(spec.plugins.bar)
|
||||
local events = spec.plugins.bar._.handlers.event
|
||||
assert(type(events) == "table")
|
||||
assert(vim.tbl_count(events) == 2)
|
||||
|
|
Loading…
Reference in New Issue