fix(health): check if bin is installed, and added message about treesitter parser

This commit is contained in:
Smirnov Oleksandr 2024-01-12 09:01:56 +02:00
parent e0a3e70e48
commit bbe89312c5

View file

@ -11,22 +11,24 @@ local deps = {
bin = { bin = {
{ {
bin = cmd.go, bin = cmd.go,
msg = "required for :GoGet, :GoMod, :GoGenerate, :GoWork, :GoInstallDeps", msg = "required for `:GoGet`, `:GoMod`, `:GoGenerate`, `:GoWork`, `:GoInstallDeps`",
optional = false, optional = false,
}, },
{ bin = cmd.gomodifytags, msg = "required for :GoTagAdd, :GoTagRm", optional = false }, { bin = cmd.gomodifytags, msg = "required for `:GoTagAdd`, `:GoTagRm`", optional = false },
{ bin = cmd.impl, msg = "required for :GoImpl", optional = false }, { bin = cmd.impl, msg = "required for `:GoImpl`", optional = false },
{ bin = cmd.iferr, msg = "required for :GoIfErr", optional = false }, { bin = cmd.iferr, msg = "required for `:GoIfErr`", optional = false },
{ {
bin = cmd.gotests, bin = cmd.gotests,
msg = "required for :GoTestAdd, :GoTestsAll, :GoTestsExp", msg = "required for `:GoTestAdd`, `:GoTestsAll`, `:GoTestsExp`",
optional = false, optional = false,
}, },
{ bin = cmd.dlv, msg = "required for debugging, (nvim-dap, `gopher.dap`)", optional = true }, { bin = cmd.dlv, msg = "required for debugging, (`nvim-dap`, `gopher.dap`)", optional = true },
}, },
} }
function health.check() function health.check()
u.info "install go treesitter parser by `:TSInstall go` if you don't have it already"
u.start "required plugins" u.start "required plugins"
for _, plugin in ipairs(deps.plugin) do for _, plugin in ipairs(deps.plugin) do
if u.is_lualib_found(plugin.lib) then if u.is_lualib_found(plugin.lib) then
@ -43,7 +45,7 @@ function health.check()
u.start "required binaries" u.start "required binaries"
u.info "all those binaries can be installed by `:GoInstallDeps`" u.info "all those binaries can be installed by `:GoInstallDeps`"
for _, bin in ipairs(deps.bin) do for _, bin in ipairs(deps.bin) do
if u.is_lualib_found(bin.bin) then if u.is_binary_found(bin.bin) then
u.ok(bin.bin .. " installed") u.ok(bin.bin .. " installed")
else else
if bin.optional then if bin.optional then