feat: lots of improvements to pipeline runner and converted all tasks to new system

This commit is contained in:
Folke Lemaitre 2022-11-28 22:03:44 +01:00
parent 4de10f9578
commit fb84c081b0
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
13 changed files with 381 additions and 200 deletions

View file

@ -69,10 +69,12 @@ function M.show()
local render = Render.new(buf, win, 2)
local update = Util.throttle(30, function()
vim.bo[buf].modifiable = true
render:update()
vim.bo[buf].modifiable = false
vim.cmd.redraw()
if buf and vim.api.nvim_buf_is_valid(buf) then
vim.bo[buf].modifiable = true
render:update()
vim.bo[buf].modifiable = false
vim.cmd.redraw()
end
end)
local function get_plugin()

View file

@ -219,11 +219,11 @@ function M:diagnostics(plugin)
if task:is_running() then
self:diagnostic({
severity = vim.diagnostic.severity.WARN,
message = task.type .. (task.status == "" and "" or (": " .. task.status)),
message = task.name .. (task.status == "" and "" or (": " .. task.status)),
})
elseif task.error then
self:diagnostic({
message = task.type .. " failed",
message = task.name .. " failed",
severity = vim.diagnostic.severity.ERROR,
})
end
@ -250,7 +250,12 @@ end
---@param plugin LazyPlugin
function M:tasks(plugin)
for _, task in ipairs(plugin._.tasks or {}) do
if task.type == "log" and not task.error then
if self._details == plugin.name then
self:append("✔ [task] ", "Title", { indent = 4 }):append(task.name)
self:append(" " .. math.floor((task:time()) * 100) / 100 .. "ms", "Bold")
self:nl()
end
if task.name == "log" and not task.error then
self:log(task)
elseif task.error or self._details == plugin.name then
if task.error then

View file

@ -33,7 +33,7 @@ return {
{
filter = function(plugin)
return has_task(plugin, function(task)
if task.type ~= "log" then
if task.name ~= "log" then
return
end
local lines = vim.split(task.output, "\n")
@ -53,10 +53,17 @@ return {
end,
title = "Updated",
},
{
---@param plugin LazyPlugin
filter = function(plugin)
return plugin._.cloned
end,
title = "Installed",
},
{
filter = function(plugin)
return has_task(plugin, function(task)
return task.type == "log" and vim.trim(task.output) ~= ""
return task.name == "log" and vim.trim(task.output) ~= ""
end)
end,
title = "Log",