Skip to content

Commit

Permalink
fix(health): show what plugins need luarocks and if none, use warning…
Browse files Browse the repository at this point in the history
…s instead of errors. See #1551
  • Loading branch information
folke committed Jun 25, 2024
1 parent 9ac3756 commit 0d9fd63
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion lua/lazy/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d9fd63

Please sign in to comment.