Skip to content

Commit

Permalink
fix: Fix healthcheck using deprecated functions
Browse files Browse the repository at this point in the history
In neovim 0.10, the vim.health.report_* functions were deprecated. It is
recommended to use the new functions which use the same name without the
"report_" prefix (i.e. vim.health.start, vim.health.ok, etc). The
deprecated functions will be removed in 0.11.
  • Loading branch information
cdevoogd authored and crispgm committed Sep 17, 2024
1 parent 769f6fc commit 78a67e2
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lua/go/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,31 @@ local M = {}
local health = vim.health or require('health')
local tools = require('go.config').tools

-- The "report_" prefix is deprecated and will be removed in 0.11. If the
-- replacements are available, we want to use those instead.
local report_start = health.start or health.report_start
local report_ok = health.ok or health.report_ok
local report_error = health.error or health.report_error
local report_info = health.info or health.report_info

function M.check()
health.report_start('Binaries')
report_start('Binaries')
local any_err = true
if vim.fn.executable('go') == 1 then
health.report_info('Go installed.')
report_info('Go installed.')
else
health.report_error('Go is not installed.')
report_error('Go is not installed.')
any_err = false
end
for _, val in ipairs(tools) do
if vim.fn.executable(val.name) == 1 then
health.report_info('Tool installed: ' .. val.name)
report_info('Tool installed: ' .. val.name)
else
health.report_error('Missing tool: ' .. val.name)
report_error('Missing tool: ' .. val.name)
end
end
if any_err then
health.report_ok('No issues found')
report_ok('No issues found')
end
end

Expand Down

0 comments on commit 78a67e2

Please sign in to comment.