From c0fd59b020dc4efb91b226b0bbc4a22f28c12321 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 27 Jun 2024 12:31:58 +0200 Subject: [PATCH] feat(health): show steps to get luarocks working. See #1570 --- lua/lazy/health.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lua/lazy/health.lua b/lua/lazy/health.lua index 2e5781e..60cb61e 100644 --- a/lua/lazy/health.lua +++ b/lua/lazy/health.lua @@ -145,11 +145,21 @@ function M.check() info("you have some plugins that require `luarocks`:\n" .. table.concat(lines, "\n")) end - require("lazy.pkg.rockspec").check({ + local ok = require("lazy.pkg.rockspec").check({ error = #need_luarocks > 0 and error or warn, warn = warn, ok = ok, }) + if not ok then + warn(table.concat({ + "Lazy won't be able to install plugins that require `luarocks`.", + "Here's what you can do:", + " - fix your `luarocks` installation", + Config.options.rocks.hererocks and " - disable *hererocks* with `opts.rocks.hererocks = false`" + or " - enable `hererocks` with `opts.rocks.hererocks = true`", + " - disable `luarocks` support completely with `opts.rocks.enabled = false`", + }, "\n")) + end else ok("luarocks disabled") end