From 0d9fd636beb9e3783edcdba2b31932280bdc05f7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 25 Jun 2024 21:15:50 +0200 Subject: [PATCH] fix(health): show what plugins need luarocks and if none, use warnings instead of errors. See #1551 --- lua/lazy/health.lua | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lua/lazy/health.lua b/lua/lazy/health.lua index 3199f758..86e805dd 100644 --- a/lua/lazy/health.lua +++ b/lua/lazy/health.lua @@ -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