From 8e9a0c2680c27699a3731a70ca0bea0382486966 Mon Sep 17 00:00:00 2001 From: glepnir Date: Sat, 4 Nov 2023 14:50:47 +0800 Subject: [PATCH] bug fix --- lua/epo/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/epo/init.lua b/lua/epo/init.lua index 0f816b7..376fa67 100644 --- a/lua/epo/init.lua +++ b/lua/epo/init.lua @@ -189,13 +189,14 @@ local function complete_ondone(bufnr) if not client then return end + -- local startidx = context[args.buf].startidx local lnum, col = unpack(api.nvim_win_get_cursor(0)) local curline = api.nvim_get_current_line() local is_snippet = completion_item.insertTextFormat == protocol.InsertTextFormat.Snippet local offset_snip --apply textEdit if completion_item.textEdit then - if is_snippet and completion_item.textEdit.newText:find('%$%d') then + if is_snippet and completion_item.textEdit.newText:find('%$') then offset_snip = completion_item.textEdit.newText else -- work around with auto pairs plugin @@ -210,6 +211,10 @@ local function complete_ondone(bufnr) else range['end'].character = col end + -- if range.start.character ~= startidx then + -- range.start.character = startidx + -- end + -- lsp.util.apply_text_edits({ completion_item.textEdit }, bufnr, client.offset_encoding) end elseif completion_item.insertTextFormat == protocol.InsertTextFormat.Snippet then