From 94ae2b766636944a35d03f84548a122fe17b5d8c Mon Sep 17 00:00:00 2001 From: ray-x Date: Sat, 26 Aug 2023 12:13:18 +1000 Subject: [PATCH] go action version checker --- lua/go/codeaction.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/go/codeaction.lua b/lua/go/codeaction.lua index 829bd12..0cbcad6 100644 --- a/lua/go/codeaction.lua +++ b/lua/go/codeaction.lua @@ -25,17 +25,17 @@ function M.run_range_code_action(t) vim.ui.select = require('guihua.gui').select vim.ui.input = require('guihua.input').input end - if vim.fn.has('nvim-0.8') == 1 then - vim.lsp.buf.code_action({ context = context, range = { start = startpos, ['end'] = endpos } }) - else - vim.lsp.buf.range_code_action(context, startpos, endpos) + if vim.fn.has('nvim-0.8') ~= 1 then + return vim.notify( + 'Please upgrade to neovim 0.8 or above', + vim.log.levels.ERROR, + { title = 'Error' } + ) end + vim.lsp.buf.code_action({ context = context, range = { start = startpos, ['end'] = endpos } }) vim.defer_fn(function() vim.ui.select = original_select - end, 1000) - - vim.defer_fn(function() vim.ui.input = original_input end, 1000) end