Job:new(...) from plenary.nvim checks whether the command is executable and fails if it's not.
This is a problem when using auto as the target module, since this will try to load every module to call the appropriate condition(), even when cargo is not installed.
Personally, I would check this in get_cargo_subcommands as
local cmd = 'cargo'
local ok, is_exe = pcall(vim.fn.executable, cmd)
if ok and 1 ~= is_exe then
utils.notify('Unable to find "cargo" executable', vim.log.levels.WARN)
return {}
end
local job = Job:new({
command = cmd,
args = { '--list' },
enabled_recording = true,
})
job:sync()
if job.code ~= 0 or job.signal ~= 0 then
utils.notify('Unable to get list of available cargo subcommands', vim.log.levels.WARN)
return {}
end
There seems to be an issue with the
cargo.lua
module.Basically, loading the module requires
cargo
being installed:cargo.tasks
callsget_cargo_subcommands()
;Job
runningcargo
;Job:new(...)
from plenary.nvim checks whether the command is executable and fails if it's not.This is a problem when using
auto
as the target module, since this will try to load every module to call the appropriatecondition()
, even whencargo
is not installed.Personally, I would check this in
get_cargo_subcommands
asHope this helps!