Skip to content

Commit

Permalink
fix(spec): make sure imported specs are sorted alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Feb 17, 2023
1 parent e5ba443 commit ff76e58
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lua/lazy/core/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ff76e58

Please sign in to comment.