Open sQVe opened 2 years ago
Your screencast is clear to understand to me but couldn't reproduce it.
https://user-images.githubusercontent.com/629908/184651314-6f2f9e17-a7c5-4266-81ad-5095813ccecc.mp4
@hrsh7th Are you selecting the first completion item in your screencast? I need to have a completion item selected to be able to reproduce this.
i think i had the same issue quite a while ago and i didn't want to confirm completions all the time so i added this, seems to be working ok:
['()'] = cmp.mapping(function()
cmp.mapping.complete()
vim.api.nvim_put({ '()' }, 'c', false, true)
end, { 'i' }),
i think i had the same issue quite a while ago and i didn't want to confirm completions all the time so i added this, seems to be working ok:
['()'] = cmp.mapping(function() cmp.mapping.complete() vim.api.nvim_put({ '()' }, 'c', false, true) end, { 'i' }),
Thank you for sharing. I'll try that first thing once I've won the battle over a certain stomach bug. Looks really promising though 🙏
@gimerstedt This does indeed seem to fix the issue! 🙏🏼
I've now mapped the following function to ()
:
local parentheses = function(fallback)
if cmp.visible() then
cmp.complete()
vim.api.nvim_put({ '()' }, 'c', false, true)
else
fallback()
end
end
I still can't reproduce this...
https://user-images.githubusercontent.com/629908/186608595-af803ff7-96b0-4770-94ab-40cf8d90cfa4.mov
I'll just note that I'm experiencing the same issue, but can't seem to figure out where it's originating from. I've tried:
And now I'm not sure where to go from here. @hrsh7th If you have any advice on where to look, I'd be happy to try and continue debugging this issue.
In the meantime, @gimerstedt 's fix works for me too.
vim.api.nvim_put({ '()' }, 'c', false, true)
This works but the cursor ends up after ()
which is a bit annoying, would be interesting to have the cursor inside brackets.
FAQ
Announcement
Minimal reproducible full config
Description
When completing with
cmp
with thetsserver
LSP it sometimes fails to register(
or)
strokes if you type them fast enough. This is fairly consistent for me and a real annoyance.Steps to reproduce
RegExp
.(
and then)
.I've only been able to reproduce this on the
tsserver
LSP. Completion via the buffer orsumneko_lua
works fine.Adding a screenrecording for clearity. The sound gives an indication of the speed of the keypresses. https://user-images.githubusercontent.com/2284724/184642619-e6989b57-8295-4a94-911f-18ddb333e66e.mp4
Expected behavior
All characters should be inputted.
Actual behavior
Inconsistent input of characters depending of speed of input.
Additional context
No response