From d4caafacc1fd0d3ff362d0dcca24918490654f6d Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Tue, 1 Jun 2021 22:13:21 +0900 Subject: fix(lsp): check mode in omnifunc callback --- runtime/lua/vim/lsp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 93ec9ed624..5a606188dd 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1421,7 +1421,7 @@ function lsp.omnifunc(findstart, base) local items = {} lsp.buf_request(bufnr, 'textDocument/completion', params, function(err, _, result) - if err or not result then return end + if err or not result or vim.fn.mode() ~= "i" then return end local matches = util.text_document_completion_list_to_complete_items(result, prefix) -- TODO(ashkan): is this the best way to do this? vim.list_extend(items, matches) -- cgit