Open aymanbagabas opened 2 months ago
It seems auto completion plugin feature.
local on_text_changed = function()
if config.enabled() then
cmp.core:on_change('TextChanged')
end
end
autocmd.subscribe({ 'TextChangedI', 'TextChangedP' }, on_text_changed)
nvim-cmp
works completion when TextChangedI
.
If you accept copilot candidate, it will trigger TextChangedI
event.
you can use
local origin = vim.o.eventignore
vim.o.eventignore = "all"
// Accept copilot source
vim.defer_fn(function()
vim.o.eventignore = origin
end, 10)
FAQ
Announcement
Minimal reproducible full config
Description
I'm using Copilot.lua and trying to use super-tab like mappings so that when I accept a suggestion, it closes the menu as if nvim-cmp finished the completion. Right now, with the above super-tab configuration, once I hit tab to complete using Copilot.lua, nvim-cmp autocomplete feature kicks in and opens the menu as if I was typing.
Steps to reproduce
Write some code.
Press tab to complete using Copilot, the menu opens up
Expected behavior
I want to be able to control the
autocomplete
feature and perhaps set a buffer flag to disable the next auto complete. So basically makeautocomplete
take a function that returns a boolean.Actual behavior
nvim-cmp always opens up the menu event after
cmp.abort()
Additional context
As a workaround, I was able to achieve what I'm looking for by wrapping
cmp.abort()
after accepting a suggestion in avim.schedule
but this feels flaky