fix(health): show what plugins need luarocks and if none, use warnings instead of errors. See #1551

This commit is contained in:
Folke Lemaitre 2024-06-25 21:15:50 +02:00
parent 9ac375653b
commit 0d9fd636be
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 20 additions and 1 deletions

View File

@ -129,7 +129,26 @@ function M.check()
else
info("checking `luarocks` installation")
end
require("lazy.pkg.rockspec").check({ error = error, warn = warn, ok = ok })
local need_luarocks = {}
for _, plugin in pairs(spec.plugins) do
if plugin.build == "rockspec" then
table.insert(need_luarocks, plugin.name)
end
end
if #need_luarocks == 0 then
ok("no plugins require `luarocks`, so you can ignore any warnings below")
else
local lines = vim.tbl_map(function(name)
return " * `" .. name .. "`"
end, need_luarocks)
info("you have some plugins that require `luarocks`:\n" .. table.concat(lines, "\n"))
end
require("lazy.pkg.rockspec").check({
error = #need_luarocks > 0 and error or warn,
warn = warn,
ok = ok,
})
else
ok("luarocks disabled")
end