This commit is contained in:
hrsh7th
2022-08-21 01:56:04 +09:00
parent 3cc0c182ec
commit 995a2a9f65

View File

@@ -369,6 +369,7 @@ core.confirm = function(self, e, option, callback)
table.insert(keys, string.sub(e.context.cursor_before_line, e:get_offset())) table.insert(keys, string.sub(e.context.cursor_before_line, e:get_offset()))
feedkeys.call(table.concat(keys, ''), 'in') feedkeys.call(table.concat(keys, ''), 'in')
else else
vim.cmd([[silent! undojoin]])
vim.api.nvim_buf_set_text(0, ctx.cursor.row - 1, e:get_offset() - 1, ctx.cursor.row - 1, ctx.cursor.col - 1, { vim.api.nvim_buf_set_text(0, ctx.cursor.row - 1, e:get_offset() - 1, ctx.cursor.row - 1, ctx.cursor.col - 1, {
string.sub(e.context.cursor_before_line, e:get_offset()), string.sub(e.context.cursor_before_line, e:get_offset()),
}) })
@@ -400,9 +401,11 @@ core.confirm = function(self, e, option, callback)
if has_cursor_line_text_edit then if has_cursor_line_text_edit then
return return
end end
vim.cmd([[silent! undojoin]])
vim.lsp.util.apply_text_edits(text_edits, ctx.bufnr, 'utf-16') vim.lsp.util.apply_text_edits(text_edits, ctx.bufnr, 'utf-16')
end) end)
else else
vim.cmd([[silent! undojoin]])
vim.lsp.util.apply_text_edits(e:get_completion_item().additionalTextEdits, ctx.bufnr, 'utf-16') vim.lsp.util.apply_text_edits(e:get_completion_item().additionalTextEdits, ctx.bufnr, 'utf-16')
end end
end) end)
@@ -460,6 +463,7 @@ core.confirm = function(self, e, option, callback)
end) end)
feedkeys.call(keymap.indentkeys(vim.bo.indentkeys), 'n') feedkeys.call(keymap.indentkeys(vim.bo.indentkeys), 'n')
feedkeys.call('', 'n', function() feedkeys.call('', 'n', function()
release()
e:execute(vim.schedule_wrap(function() e:execute(vim.schedule_wrap(function()
release() release()
self.event:emit('confirm_done', { self.event:emit('confirm_done', {