Skip to content

Commit fd94e69

Browse files
committed
fix(event): pass data to event lazy loaders. Fixes #922
1 parent 5af331e commit fd94e69

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lua/lazy/core/handler/event.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function M:_add(value)
2323
group = self.group,
2424
once = true,
2525
pattern = pattern,
26-
callback = function()
26+
callback = function(ev)
2727
if not self.active[value] then
2828
return
2929
end
@@ -32,7 +32,7 @@ function M:_add(value)
3232
-- load the plugins
3333
Loader.load(self.active[value], { [self.type] = value })
3434
-- check if any plugin created an event handler for this event and fire the group
35-
self:trigger(event, pattern, groups)
35+
self:trigger(event, pattern, groups, ev.data)
3636
Util.track()
3737
end,
3838
})
@@ -61,7 +61,7 @@ end
6161
---@param event string|string[]
6262
---@param pattern? string
6363
---@param groups table<string,true>
64-
function M:trigger(event, pattern, groups)
64+
function M:trigger(event, pattern, groups, data)
6565
local events = M.trigger_events[event] or { event }
6666
---@cast events string[]
6767
for _, e in ipairs(events) do
@@ -77,7 +77,7 @@ function M:trigger(event, pattern, groups)
7777
end
7878
Util.track({ event = autocmd.group_name })
7979
Util.try(function()
80-
vim.api.nvim_exec_autocmds(autocmd.event, { group = autocmd.group, modeline = false })
80+
vim.api.nvim_exec_autocmds(autocmd.event, { group = autocmd.group, modeline = false, data = data })
8181
Util.track()
8282
end)
8383
end

0 commit comments

Comments
 (0)