Skip to content

Commit

Permalink
fix(health): show error if setup didn't run
Browse files Browse the repository at this point in the history
* Fix back bootstrapping and healthcheck for fresh install with no packages to fetch.

* Revert changes to bootstrapping, make checkhealth produce more meaningful message.
  • Loading branch information
Ulibos authored Apr 27, 2023
1 parent 903f0fe commit 0c7b418
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions lua/lazy/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,23 @@ function M.check()
end

local spec = Config.spec
for _, plugin in pairs(spec.plugins) do
M.check_valid(plugin)
M.check_override(plugin)
end
if #spec.notifs > 0 then
error("Issues were reported when loading your specs:")
for _, notif in ipairs(spec.notifs) do
local lines = vim.split(notif.msg, "\n")
for _, line in ipairs(lines) do
if notif.level == vim.log.levels.ERROR then
error(line)
else
warn(line)
if spec == nil then
error("No plugins loaded. Did you forget to run `require(\"lazy\").setup()`?")
else
for _, plugin in pairs(spec.plugins) do
M.check_valid(plugin)
M.check_override(plugin)
end
if #spec.notifs > 0 then
error("Issues were reported when loading your specs:")
for _, notif in ipairs(spec.notifs) do
local lines = vim.split(notif.msg, "\n")
for _, line in ipairs(lines) do
if notif.level == vim.log.levels.ERROR then
error(line)
else
warn(line)
end
end
end
end
Expand Down

0 comments on commit 0c7b418

Please sign in to comment.