From ff76e58961509038e3e0365c47580e595977a3a2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 17 Feb 2023 13:58:16 +0100 Subject: [PATCH] fix(spec): make sure imported specs are sorted alphabetically --- lua/lazy/core/plugin.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index b79cc6b..edd8ff0 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -254,7 +254,15 @@ function Spec:import(spec) self.modules[#self.modules + 1] = spec.import local imported = 0 + + ---@type string[] + local modnames = {} Util.lsmod(spec.import, function(modname) + modnames[#modnames + 1] = modname + end) + table.sort(modnames) + + for _, modname in ipairs(modnames) do imported = imported + 1 Util.track({ import = modname }) self.importing = modname @@ -273,7 +281,7 @@ function Spec:import(spec) Util.track() end, }) - end) + end if imported == 0 then self:error("No specs found for module " .. spec.import) end