Fix #963
Fix #966
This commit is contained in:
hrsh7th
2022-05-04 23:51:59 +09:00
parent c6126cca36
commit f81bfee109
3 changed files with 19 additions and 20 deletions

View File

@@ -287,7 +287,7 @@ cmp.setup = setmetatable({
-- In InsertEnter autocmd, vim will detects mode=normal unexpectedly.
autocmd.subscribe(
{ 'InsertEnter', 'CmdlineEnter' },
async.debounce_safe_state(function()
async.debounce_next_tick(function()
if config.enabled() then
cmp.config.compare.scopes:update()
cmp.config.compare.locality:update()
@@ -300,31 +300,31 @@ autocmd.subscribe(
-- async.throttle is needed for performance. The mapping `:<C-u>...<CR>` will fire `CmdlineChanged` for each character.
autocmd.subscribe(
{ 'TextChangedI', 'TextChangedP', 'CmdlineChanged' },
async.debounce_safe_state(function()
async.debounce_next_tick(function()
if config.enabled() then
cmp.core:on_change('TextChanged')
end
end)
)
autocmd.subscribe(
'CursorMovedI',
async.debounce_next_tick(function()
if config.enabled() then
cmp.core:on_moved()
else
cmp.core:reset()
cmp.core.view:close()
end
end)
)
-- If make this asynchronous, the completion menu will not close when the command output is displayed.
autocmd.subscribe({ 'InsertLeave', 'CmdlineLeave' }, function()
cmp.core:reset()
cmp.core.view:close()
end)
autocmd.subscribe(
'CursorMovedI',
async.debounce_safe_state(function()
if config.enabled() then
cmp.core:on_moved()
else
cmp.core:reset()
cmp.core.view:close()
end
end)
)
cmp.event:on('complete_done', function(evt)
if evt.entry then
cmp.config.compare.recently_used:add_entry(evt.entry)