Skip to content

Commit 0c7b418

Browse files
authored
fix(health): show error if setup didn't run
* Fix back bootstrapping and healthcheck for fresh install with no packages to fetch. * Revert changes to bootstrapping, make checkhealth produce more meaningful message.
1 parent 903f0fe commit 0c7b418

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

lua/lazy/health.lua

+17-13
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,23 @@ function M.check()
5353
end
5454

5555
local spec = Config.spec
56-
for _, plugin in pairs(spec.plugins) do
57-
M.check_valid(plugin)
58-
M.check_override(plugin)
59-
end
60-
if #spec.notifs > 0 then
61-
error("Issues were reported when loading your specs:")
62-
for _, notif in ipairs(spec.notifs) do
63-
local lines = vim.split(notif.msg, "\n")
64-
for _, line in ipairs(lines) do
65-
if notif.level == vim.log.levels.ERROR then
66-
error(line)
67-
else
68-
warn(line)
56+
if spec == nil then
57+
error("No plugins loaded. Did you forget to run `require(\"lazy\").setup()`?")
58+
else
59+
for _, plugin in pairs(spec.plugins) do
60+
M.check_valid(plugin)
61+
M.check_override(plugin)
62+
end
63+
if #spec.notifs > 0 then
64+
error("Issues were reported when loading your specs:")
65+
for _, notif in ipairs(spec.notifs) do
66+
local lines = vim.split(notif.msg, "\n")
67+
for _, line in ipairs(lines) do
68+
if notif.level == vim.log.levels.ERROR then
69+
error(line)
70+
else
71+
warn(line)
72+
end
6973
end
7074
end
7175
end

0 commit comments

Comments
 (0)