docs: move vim.health documentation to lua.txt

`vim.health` is not a "plugin" but part of our Lua API and the
documentation should reflect that. This also helps make the
documentation maintenance easier as it is now generated.
This commit is contained in:
dundargoc
2024-05-22 16:07:45 +02:00
committed by dundargoc
parent 339129ebc9
commit e8f7025de1
11 changed files with 248 additions and 155 deletions

View File

@@ -9,7 +9,7 @@ function M.check()
os.getenv('TMUX')
and vim.fn.executable('tmux') == 1
and vim.fn.executable('pbpaste') == 1
and not health.cmd_ok('pbpaste')
and not health._cmd_ok('pbpaste')
then
local tmux_version = string.match(vim.fn.system('tmux -V'), '%d+%.%d+')
local advice = {

View File

@@ -6,7 +6,7 @@ local M = {}
function M.check()
health.start('Node.js provider (optional)')
if health.provider_disabled('node') then
if health._provider_disabled('node') then
return
end
@@ -26,7 +26,7 @@ function M.check()
end
-- local node_v = vim.fn.split(system({'node', '-v'}), "\n")[1] or ''
local ok, node_v = health.cmd_ok({ 'node', '-v' })
local ok, node_v = health._cmd_ok({ 'node', '-v' })
health.info('Node.js: ' .. node_v)
if not ok or vim.version.lt(node_v, '6.0.0') then
health.warn('Nvim node.js host does not support Node ' .. node_v)
@@ -63,7 +63,7 @@ function M.check()
iswin and 'cmd /c ' .. manager .. ' info neovim --json' or manager .. ' info neovim --json'
)
local latest_npm
ok, latest_npm = health.cmd_ok(vim.split(latest_npm_cmd, ' '))
ok, latest_npm = health._cmd_ok(vim.split(latest_npm_cmd, ' '))
if not ok or latest_npm:find('^%s$') then
health.error(
'Failed to run: ' .. latest_npm_cmd,
@@ -81,7 +81,7 @@ function M.check()
local current_npm_cmd = { 'node', host, '--version' }
local current_npm
ok, current_npm = health.cmd_ok(current_npm_cmd)
ok, current_npm = health._cmd_ok(current_npm_cmd)
if not ok then
health.error(
'Failed to run: ' .. table.concat(current_npm_cmd, ' '),

View File

@@ -5,7 +5,7 @@ local M = {}
function M.check()
health.start('Perl provider (optional)')
if health.provider_disabled('perl') then
if health._provider_disabled('perl') then
return
end
@@ -24,7 +24,7 @@ function M.check()
-- we cannot use cpanm that is on the path, as it may not be for the perl
-- set with g:perl_host_prog
local ok = health.cmd_ok({ perl_exec, '-W', '-MApp::cpanminus', '-e', '' })
local ok = health._cmd_ok({ perl_exec, '-W', '-MApp::cpanminus', '-e', '' })
if not ok then
return { perl_exec, '"App::cpanminus" module is not installed' }
end
@@ -36,7 +36,7 @@ function M.check()
'my $app = App::cpanminus::script->new; $app->parse_options ("--info", "-q", "Neovim::Ext"); exit $app->doit',
}
local latest_cpan
ok, latest_cpan = health.cmd_ok(latest_cpan_cmd)
ok, latest_cpan = health._cmd_ok(latest_cpan_cmd)
if not ok or latest_cpan:find('^%s*$') then
health.error(
'Failed to run: ' .. table.concat(latest_cpan_cmd, ' '),
@@ -67,7 +67,7 @@ function M.check()
local current_cpan_cmd = { perl_exec, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION' }
local current_cpan
ok, current_cpan = health.cmd_ok(current_cpan_cmd)
ok, current_cpan = health._cmd_ok(current_cpan_cmd)
if not ok then
health.error(
'Failed to run: ' .. table.concat(current_cpan_cmd, ' '),

View File

@@ -70,7 +70,7 @@ end
local function download(url)
local has_curl = vim.fn.executable('curl') == 1
if has_curl and vim.fn.system({ 'curl', '-V' }):find('Protocols:.*https') then
local out, rc = health.system({ 'curl', '-sL', url }, { stderr = true, ignore_error = true })
local out, rc = health._system({ 'curl', '-sL', url }, { stderr = true, ignore_error = true })
if rc ~= 0 then
return 'curl error with ' .. url .. ': ' .. rc
else
@@ -83,7 +83,7 @@ local function download(url)
from urllib2 import urlopen\n\
response = urlopen('" .. url .. "')\n\
print(response.read().decode('utf8'))\n"
local out, rc = health.system({ 'python', '-c', script })
local out, rc = health._system({ 'python', '-c', script })
if out == '' and rc ~= 0 then
return 'python urllib.request error: ' .. rc
else
@@ -140,7 +140,7 @@ end
local function version_info(python)
local pypi_version = latest_pypi_version()
local python_version, rc = health.system({
local python_version, rc = health._system({
python,
'-c',
'import sys; print(".".join(str(x) for x in sys.version_info[:3]))',
@@ -151,7 +151,7 @@ local function version_info(python)
end
local nvim_path
nvim_path, rc = health.system({
nvim_path, rc = health._system({
python,
'-c',
'import sys; sys.path = [p for p in sys.path if p != ""]; import neovim; print(neovim.__file__)',
@@ -176,7 +176,7 @@ local function version_info(python)
-- Try to get neovim.VERSION (added in 0.1.11dev).
local nvim_version
nvim_version, rc = health.system({
nvim_version, rc = health._system({
python,
'-c',
'from neovim import VERSION as v; print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))',
@@ -223,7 +223,7 @@ function M.check()
local host_prog_var = pyname .. '_host_prog'
local python_multiple = {}
if health.provider_disabled(pyname) then
if health._provider_disabled(pyname) then
return
end
@@ -265,7 +265,7 @@ function M.check()
end
if pyenv ~= '' then
python_exe = health.system({ pyenv, 'which', pyname }, { stderr = true })
python_exe = health._system({ pyenv, 'which', pyname }, { stderr = true })
if python_exe == '' then
health.warn('pyenv could not find ' .. pyname .. '.')
end
@@ -488,7 +488,7 @@ function M.check()
health.info(msg)
health.info(
'Python version: '
.. health.system(
.. health._system(
'python -c "import platform, sys; sys.stdout.write(platform.python_version())"'
)
)

View File

@@ -6,7 +6,7 @@ local M = {}
function M.check()
health.start('Ruby provider (optional)')
if health.provider_disabled('ruby') then
if health._provider_disabled('ruby') then
return
end
@@ -17,7 +17,7 @@ function M.check()
)
return
end
health.info('Ruby: ' .. health.system({ 'ruby', '-v' }))
health.info('Ruby: ' .. health._system({ 'ruby', '-v' }))
local host, _ = vim.provider.ruby.detect()
if (not host) or host:find('^%s*$') then
@@ -33,7 +33,7 @@ function M.check()
health.info('Host: ' .. host)
local latest_gem_cmd = (iswin and 'cmd /c gem list -ra "^^neovim$"' or 'gem list -ra ^neovim$')
local ok, latest_gem = health.cmd_ok(vim.split(latest_gem_cmd, ' '))
local ok, latest_gem = health._cmd_ok(vim.split(latest_gem_cmd, ' '))
if not ok or latest_gem:find('^%s*$') then
health.error(
'Failed to run: ' .. latest_gem_cmd,
@@ -46,7 +46,7 @@ function M.check()
local current_gem_cmd = { host, '--version' }
local current_gem
ok, current_gem = health.cmd_ok(current_gem_cmd)
ok, current_gem = health._cmd_ok(current_gem_cmd)
if not ok then
health.error(
'Failed to run: ' .. table.concat(current_gem_cmd, ' '),