diff --git a/lua/go.lua b/lua/go.lua index a1501f1..78216ce 100644 --- a/lua/go.lua +++ b/lua/go.lua @@ -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) diff --git a/lua/go/health.lua b/lua/go/health.lua index 5f9f13a..bc67de2 100644 --- a/lua/go/health.lua +++ b/lua/go/health.lua @@ -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() diff --git a/lua/go/lsp_diag.lua b/lua/go/lsp_diag.lua index ac99ac9..434fa51 100644 --- a/lua/go/lsp_diag.lua +++ b/lua/go/lsp_diag.lua @@ -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,