Open b3nj5m1n opened 1 year ago
I have the same problem, eventhrough I don't mapping any complete
for tab
:
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { 'i', 's' }),
This problem does not occur unless the files are switched using Telescope find_files
I'm also having the same issue specifically with rust_analyzer's
snippet for match
, but I couldn't reproduce the issue in a mininal config.
It seems to be an issue with the snippet's first line being expanded when moving the cmp selection over it. As a workaround I disabled inserting the hovered text by setting this in cmp's .setup()
(see :help cmp.select_next_item
), which fixes the issue:
{
mapping = {
['<C-j>'] = cmp_map(cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select })),
['<C-k>'] = cmp_map(cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select })),
}
}
Been having the same issue as well.
Don't like to use cmp.SelectBehavior.Select
because I have a habit of pressing escape after selecting the next item via <C-n>
and I expect that the selected text was inserted.
It seems there is a related issue here https://github.com/hrsh7th/nvim-cmp/issues/1780
But @hrsh7th mentioned it has been fixed so I'm not really sure why this still happens
https://github.com/hrsh7th/nvim-cmp/assets/10972027/c2601816-033e-4616-abea-443a83b5296a
hi, any process about this?
I was experiencing this even without any autopair plugin, if the completion item had some opening character (usually (
, [
, {
). Setting behavior = cmp.SelectBehavior.Select
did work around the issue, even after re-enabling the ultimate-autopairs plugin.
FAQ
Announcement
Minimal reproducible full config
Description
When cycling through the auto-complete menu using
ctrl+n
with nvim-parinfer enabled, at some point a snippet will insert itself automatically and close the completion menu.Steps to reproduce
Using the minimal config, open a clojure file (or any other file that makes use of parinfer, like fennel or common lisp), wait for the lsp to load, then type something like
def
and start cycling through the suggsted completions usingctrl+n
.Expected behavior
You can go forwards & backwards in the completion menu as much as you want, at some point you select an item from the selections.
Actual behavior
After hitting
ctrl+n
twice, a snippet automatically inserts itself and closes the completion menu.Additional context
nvim-parinfer automatically tries to balance parens, so when it encounters an unclosed opening parenthesis, it will insert a closing parenthesis where it thinks it belongs. I believe because the snippet includes parenthesis, this somehow causes one of the plugins to break.
I'm pretty sure this was working before I updated nvim-cmp, I was probably a few months out of date, so I think this has probably been introduced somewhat recently in this plugin, although I'm not 100% sure. nvim-parinfer has not had any updates in this timeframe.