From 30e7e057718973c86e3dc811c21000ce9a5c2050 Mon Sep 17 00:00:00 2001 From: Squibid Date: Thu, 25 Jul 2024 20:01:23 -0400 Subject: make sure the load function is called on dep reloading --- lua/dep.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/dep.lua b/lua/dep.lua index c6deb9f..378ef82 100644 --- a/lua/dep.lua +++ b/lua/dep.lua @@ -11,7 +11,7 @@ local logger = require("dep.log").global local proc = require("dep.proc") local initialized, perf, config_path, base_dir -local packages, root +local packages, root, load local function bench(name, code, ...) local start = os.clock() @@ -396,6 +396,16 @@ local function reload() end local function reload_all() + -- recall the load function + if load and type(load) == "function" then + local ok, ret = pcall(load) + if ok and type(ret) == "table" then + register_recursive(ret) + else + logger:log("error", ret) + end + end + for i = 1, #packages do local package = packages[i] package.loaded, package.subtree_loaded = false, false @@ -832,6 +842,7 @@ return setmetatable({ if config["load"] and type(config["load"]) == "function" then local ok, ret = pcall(config["load"]) if ok and type(ret) == "table" then + load = config["load"] register_recursive(ret) else logger:log("error", ret) -- cgit v1.2.1