fix healthcheck

This commit is contained in:
relar 2024-03-16 15:50:42 +01:00
parent ea4335f5af
commit c995aee6fc
1 changed files with 9 additions and 9 deletions

View File

@ -8,14 +8,14 @@
local check_version = function() local check_version = function()
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch) local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
if not vim.version.cmp then if not vim.version.cmp then
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) vim.health.report_error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
return return
end end
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then if vim.version.cmp(verstr, '0.9.4') >= 0 then
vim.health.ok(string.format("Neovim version is: '%s'", verstr)) vim.health.report_ok(string.format("Neovim version is: '%s'", verstr))
else else
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) vim.health.report_error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
end end
end end
@ -24,9 +24,9 @@ local check_external_reqs = function()
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
local is_executable = vim.fn.executable(exe) == 1 local is_executable = vim.fn.executable(exe) == 1
if is_executable then if is_executable then
vim.health.ok(string.format("Found executable: '%s'", exe)) vim.health.report_ok(string.format("Found executable: '%s'", exe))
else else
vim.health.warn(string.format("Could not find executable: '%s'", exe)) vim.health.report_warn(string.format("Could not find executable: '%s'", exe))
end end
end end
@ -35,16 +35,16 @@ end
return { return {
check = function() check = function()
vim.health.start 'kickstart.nvim' vim.health.report_start 'kickstart.nvim'
vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth` vim.health.report_info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
Fix only warnings for plugins and languages you intend to use. Fix only warnings for plugins and languages you intend to use.
Mason will give warnings for languages that are not installed. Mason will give warnings for languages that are not installed.
You do not need to install, unless you want to use those languages!]] You do not need to install, unless you want to use those languages!]]
local uv = vim.uv or vim.loop local uv = vim.uv or vim.loop
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname())) vim.health.report_info('System Information: ' .. vim.inspect(uv.os_uname()))
check_version() check_version()
check_external_reqs() check_external_reqs()