fix(pack): load plugin configs in declared order

This commit is contained in:
2026-05-07 03:03:01 +02:00
parent e9d13627c8
commit 25db26b3e3
+12 -7
View File
@@ -266,8 +266,10 @@ end
---@param specs (string | ow.Pack.Spec)[] ---@param specs (string | ow.Pack.Spec)[]
function M.setup(specs) function M.setup(specs)
local pack_specs = {} local pack_specs = {}
local order = {}
for _, spec in ipairs(specs) do for _, spec in ipairs(specs) do
local src = type(spec) == "string" and spec or spec.src local src = type(spec) == "string" and spec or spec.src
table.insert(order, src)
if is_url(src) then if is_url(src) then
table.insert(pack_specs, to_pack_spec(spec)) table.insert(pack_specs, to_pack_spec(spec))
else else
@@ -302,15 +304,18 @@ function M.setup(specs)
vim.cmd.packadd(plugin.name) vim.cmd.packadd(plugin.name)
end) end)
for _, plugin in pairs(M.plugins) do for _, src in ipairs(order) do
if plugin.build then local plugin = M.plugins[src]
local data = changed[plugin.src] if plugin then
if data then if plugin.build then
plugin.path = data.path local data = changed[plugin.src]
run_build(plugin) if data then
plugin.path = data.path
run_build(plugin)
end
end end
load(plugin.name, false)
end end
load(plugin.name, false)
end end
vim.api.nvim_create_autocmd("PackChanged", { vim.api.nvim_create_autocmd("PackChanged", {