From 85e375223f21e35fd5f779cad05be0397557e72a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 17 Dec 2022 14:28:41 +0100 Subject: [PATCH] fix(ui): always clear complete tasks with the same name when starting a new task --- lua/lazy/manage/task/init.lua | 5 ++++- lua/lazy/view/render.lua | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/lazy/manage/task/init.lua b/lua/lazy/manage/task/init.lua index 0296d18..92596e3 100644 --- a/lua/lazy/manage/task/init.lua +++ b/lua/lazy/manage/task/init.lua @@ -9,7 +9,6 @@ local Process = require("lazy.manage.process") ---@class LazyTask ---@field plugin LazyPlugin ---@field name string ----@field type string ---@field output string ---@field status string ---@field error? string @@ -40,6 +39,10 @@ function Task.new(plugin, name, task, opts) self.output = "" self.status = "" plugin._.tasks = plugin._.tasks or {} + ---@param other LazyTask + plugin._.tasks = vim.tbl_filter(function(other) + return other.name ~= name or other:is_running() + end, plugin._.tasks) table.insert(plugin._.tasks, self) return self end diff --git a/lua/lazy/view/render.lua b/lua/lazy/view/render.lua index a2544cd..0ff5e6f 100644 --- a/lua/lazy/view/render.lua +++ b/lua/lazy/view/render.lua @@ -338,7 +338,6 @@ end ---@param task LazyTask function M:log(task) - -- FIXME: only show last log task local log = vim.trim(task.output) if log ~= "" then local lines = vim.split(log, "\n")