perf(rocks): vim.fn.executable is slow on WSL2, so only check for luarocks when needed. Closes #1585

This commit is contained in:
Folke Lemaitre 2024-06-29 11:44:31 +02:00
parent 8dd947fccd
commit 9ab3061690
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
4 changed files with 21 additions and 11 deletions

View file

@ -72,7 +72,7 @@ function M.check(opts)
}, opts or {})
local ok = false
if Config.options.rocks.hererocks then
if Config.hererocks() then
if M.hererocks.building() then
ok = true
else
@ -119,7 +119,7 @@ function M.build(task)
"",
"This plugin requires `luarocks`. Try one of the following:",
" - fix your `luarocks` installation",
Config.options.rocks.hererocks and " - disable *hererocks* with `opts.rocks.hererocks = false`"
Config.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`",
})
@ -132,7 +132,7 @@ function M.build(task)
local env = {}
local luarocks = "luarocks"
if Config.options.rocks.hererocks then
if Config.hererocks() then
-- hererocks is still building, so skip for now
-- a new build will happen in the next round
if M.hererocks.building() then