Skip to content

Commit

Permalink
feat(task): build procs can now yield a LazyMsg for more control
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 28, 2024
1 parent ec95702 commit 9cf7459
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/lazy/manage/task/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ function Task:_run(task)
task(self, self._opts)
end

---@param msg string|string[]
---@param msg string|string[]|LazyMsg
---@param level? number
function Task:log(msg, level)
if type(msg) == "table" and msg.msg then
level = msg.level or level
msg = msg.msg
end
level = level or vim.log.levels.DEBUG
self._level = math.max(self._level or 0, level or 0)
msg = type(msg) == "table" and table.concat(msg, "\n") or msg
Expand Down Expand Up @@ -170,8 +174,8 @@ function Task:_done()
if self._opts.on_done then
self._opts.on_done(self)
end
self:render()
vim.schedule(function()
self:render()
vim.api.nvim_exec_autocmds("User", {
pattern = "LazyPlugin" .. self.name:sub(1, 1):upper() .. self.name:sub(2),
data = { plugin = self.plugin.name },
Expand Down

0 comments on commit 9cf7459

Please sign in to comment.