fix(feedkeys): resolve issue with some copilot completions (#1981)

* fix(feedkeys): resolve issue with some copilot completions

* fix(feedkey): further adjustments

* fix: missed flag from testing

* fix(feedkeys): error handle and make tests pass
This commit is contained in:
Tristan Knight 2024-07-14 07:04:40 +01:00 committed by GitHub
parent a110e12d0b
commit 7e348da6e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -14,7 +14,7 @@ feedkeys.call = setmetatable({
if #keys > 0 then
table.insert(queue, { keymap.t('<Cmd>setlocal lazyredraw<CR>'), 'n' })
table.insert(queue, { keymap.t('<Cmd>setlocal textwidth=0<CR>'), 'n' })
table.insert(queue, { keymap.t('<Cmd>setlocal backspace=2<CR>'), 'n' })
table.insert(queue, { keymap.t('<Cmd>setlocal backspace=nostop<CR>'), 'n' })
table.insert(queue, { keys, string.gsub(mode, '[itx]', ''), true })
table.insert(queue, { keymap.t('<Cmd>setlocal %slazyredraw<CR>'):format(vim.o.lazyredraw and '' or 'no'), 'n' })
table.insert(queue, { keymap.t('<Cmd>setlocal textwidth=%s<CR>'):format(vim.bo.textwidth or 0), 'n' })
@ -44,7 +44,10 @@ feedkeys.call = setmetatable({
})
feedkeys.run = function(id)
if feedkeys.call.callbacks[id] then
feedkeys.call.callbacks[id]()
local ok, err = pcall(feedkeys.call.callbacks[id])
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
feedkeys.call.callbacks[id] = nil
end
return ''

View file

@ -1,7 +1,7 @@
local config = require('cmp.config')
local misc = require('cmp.utils.misc')
local snippet = require('cmp.utils.snippet')
local str = require('cmp.utils.str')
-- local str = require('cmp.utils.str')
local api = require('cmp.utils.api')
local types = require('cmp.types')