Merge pull request #14698 from jose-elias-alvarez/omnifunc-insert-check

fix(lsp): check mode in omnifunc callback
This commit is contained in:
Michael Lingelbach
2021-06-01 10:13:17 -07:00
committed by GitHub

View File

@@ -1421,7 +1421,7 @@ function lsp.omnifunc(findstart, base)
local items = {} local items = {}
lsp.buf_request(bufnr, 'textDocument/completion', params, function(err, _, result) 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) local matches = util.text_document_completion_list_to_complete_items(result, prefix)
-- TODO(ashkan): is this the best way to do this? -- TODO(ashkan): is this the best way to do this?
vim.list_extend(items, matches) vim.list_extend(items, matches)