nvim 0.9 health API updates

This commit is contained in:
ray-x 2023-04-24 11:06:03 +10:00
parent e7e914cdc3
commit 8bb852ba15
3 changed files with 19 additions and 13 deletions

View File

@ -133,6 +133,9 @@ _GO_NVIM_CFG = {
-- TODO: nvim_{add,del}_user_command https://github.com/neovim/neovim/pull/16752
function go.setup(cfg)
if vim.fn.has('nvim-0.8') == 0 then
vim.notify('go.nvim master branch requires nvim 0.8', vim.log.levels.WARN)
end
cfg = cfg or {}
if cfg.max_len then
vim.notify('go.nvim max_len renamed to max_line_len', vim.log.levels.WARN)

View File

@ -9,11 +9,14 @@ if not vim.health then
end
local tools = require('go.install').tools
local start = health.report_start
local ok = health.report_ok
local error = health.report_error
local warn = health.report_warn
local info = health.report_info
local nvim_09 = vim.fn.has('nvim-0.9') == 1
local start = nvim_09 and health.start or health.report_start
local ok = nvim_09 and health.ok or health.report_ok
local error = nvim_09 and health.error or health.report_error
local warn = nvim_09 and health.warn or health.report_warn
local info = nvim_09 and health.infor or health.report_info
local vfn = vim.fn
local function binary_check()
@ -59,7 +62,9 @@ local function binary_check()
if no_err then
ok('All binaries installed')
else
warn('Some binaries are not installed, please check if your $HOME/go/bin or $GOBIN $exists and in your $PATH')
warn(
'Some binaries are not installed, please check if your $HOME/go/bin or $GOBIN $exists and in your $PATH'
)
end
end
@ -129,13 +134,16 @@ local function env_check()
end
end
if any_warn then
info('Not all enviroment variables set')
info('Not all environment variables set')
else
ok('All enviroment variables set')
ok('All environment variables set')
end
end
function M.check()
if vim.fn.has('nvim-0.8.3') == 0 then
warn('Suggested neovim version 0.8.3 or higher')
end
binary_check()
plugin_check()
env_check()

View File

@ -4,7 +4,6 @@
-- New signature on_publish_diagnostics({_}, {result}, {ctx}, {config})
debug = debug or nil
local vfn = vim.fn
local nvim_0_6 = (vfn.has('nvim-0.6') == 1)
local function hdlr(result)
if result and result.diagnostics then
@ -39,10 +38,6 @@ local diag_hdlr_0_6 = function(err, result, ctx, config)
hdlr(result)
end
if not nvim_0_6 then
vim.notify('nvim 0.6 required for lsp diagnostics')
end
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(diag_hdlr_0_6, {
-- Enable underline, use default values
underline = _GO_NVIM_CFG.lsp_diag_underline,