From 2705f55b2580f902c7e4bb2a4c3f96d27d4a747b Mon Sep 17 00:00:00 2001 From: Squibid Date: Sat, 29 Apr 2023 11:02:06 -0400 Subject: sync: add on_complete callback -- taken from trsdln on github --- lua/dep.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lua/dep.lua') diff --git a/lua/dep.lua b/lua/dep.lua index f0e2f7b..4cf2ddd 100644 --- a/lua/dep.lua +++ b/lua/dep.lua @@ -548,7 +548,7 @@ local function sync(package, cb) end end -local function sync_list(list) +local function sync_list(list, on_complete) local progress = 0 local has_errors = false @@ -565,6 +565,10 @@ local function sync_list(list) else logger:log("update", string.format("synchronized %s %s", #list, #list == 1 and "package" or "packages")) end + + if on_complete then + on_complete() + end end end @@ -819,8 +823,8 @@ end --todo: prevent multiple execution of async routines return setmetatable({ - sync = wrap_api("dep.sync", function() - sync_list(packages) + sync = wrap_api("dep.sync", function(on_complete) + sync_list(packages, on_complete) end), reload = wrap_api("dep.reload", reload_all), -- cgit v1.2.1