mirror of
https://github.com/zoriya/lz.n.git
synced 2026-06-02 02:45:11 +00:00
chore: simplify LzPluginHandler type
This commit is contained in:
@@ -151,8 +151,9 @@ end
|
||||
|
||||
---@param plugin LzPlugin
|
||||
function M.add(plugin)
|
||||
-- TODO add plugin to M.pending
|
||||
for _, event in pairs(plugin.event or {}) do
|
||||
M.pending[event.id] = M.pending[event.id] or {}
|
||||
M.pending[event.id][plugin.name] = plugin.name
|
||||
add_event(event)
|
||||
end
|
||||
end
|
||||
|
||||
+5
-5
@@ -31,11 +31,11 @@ error("Cannot import a meta module")
|
||||
---@field after? fun(self:LzPlugin, opts:table)|true Will be executed when loading the plugin
|
||||
---@field opts? PluginOpts
|
||||
|
||||
---@class LzPluginHandlers -- keys = plugin names
|
||||
---@field event? table<string,LzEvent>
|
||||
---@field ft? table<string,LzEvent>
|
||||
---@field keys? table<string,LzKeys>
|
||||
---@field cmd? table<string,string>
|
||||
---@class LzPluginHandlers
|
||||
---@field event? LzEvent[]
|
||||
---@field ft? LzEvent[]
|
||||
---@field keys? LzKeys[]
|
||||
---@field cmd? string[]
|
||||
|
||||
---@class LzPluginSpecHandlers
|
||||
---@field event? string|LzEventSpec[]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local event = require("lz.n.handler.event")
|
||||
-- local loader = require("lz.n.loader")
|
||||
|
||||
describe("event", function()
|
||||
it("can parse from string", function()
|
||||
@@ -38,4 +39,14 @@ describe("event", function()
|
||||
})
|
||||
)
|
||||
end)
|
||||
it("integration", function()
|
||||
---@type LzPlugin
|
||||
local plugin = {
|
||||
name = "foo",
|
||||
event = { { id = "BufEnter", event = "BufEnter" } },
|
||||
pattern = ".lua",
|
||||
}
|
||||
event.add(plugin)
|
||||
-- TODO
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user