diff --git a/README.md b/README.md index 28bf5af..a01be2e 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,13 @@ vim.keymap.set('i', '', function() return '' end end, { expr = true }) + +vim.keymap.set('i', '', function() + if vim.fn.pumvisible() == 1 then + require('epo').disable_trigger() + end + return '' +end, {expr = true}) ``` diff --git a/lua/epo/init.lua b/lua/epo/init.lua index 02df5b2..0f816b7 100644 --- a/lua/epo/init.lua +++ b/lua/epo/init.lua @@ -190,11 +190,6 @@ local function complete_ondone(bufnr) return end local lnum, col = unpack(api.nvim_win_get_cursor(0)) - if completion_item.additionalTextEdits then - lsp.util.apply_text_edits(completion_item.additionalTextEdits, bufnr, 'utf-8') - end - local startidx = context[args.buf].startidx - local curline = api.nvim_get_current_line() local is_snippet = completion_item.insertTextFormat == protocol.InsertTextFormat.Snippet local offset_snip @@ -228,6 +223,12 @@ local function complete_ondone(bufnr) end end + -- addtional usually for import header + -- so make it applied after textEdit + if completion_item.additionalTextEdits then + lsp.util.apply_text_edits(completion_item.additionalTextEdits, bufnr, 'utf-8') + end + if signature then local clients = vim.lsp.get_clients({ bufnr = args.buf, method = ms.textDocument_signatureHelp })