jiangmiao/auto-pairs

conflict with coc.nvim auto-completion in some situation

Closed this issue · 6 comments

Auto-completion was messed up in certain situation, tested with minimal configuration in docker.

.vimrc
vimrc.txt

screen record

rec.mp4

What's the output of

imap <cr>
imap <SNR>1234_AutoPairsOldCRWrapper1234

where 1234 is replaced with the numbers you see in imap <cr>?

What's the output of

imap <cr>
imap <SNR>1234_AutoPairsOldCRWrapper1234

where 1234 is replaced with the numbers you see in imap <cr>?

the output of "imap <cr>":
i &@16_AutoPairsOldCRWrapper7316_AutoPairsReturn
i * coc#pum#visible() ? coc#_select_confirm() : "<C-G>u<CR>"

the output of "imap <SNR>16_AutoPairsOldCRWrapper73":
i 16_AutoPairsOldCRWrapper73 &@coc#pum#visible() ? coc#_select_confirm() : "
u<CR>"

Finally reproduced it. Looks like both SNRs are invoked, which sounds like the most plausible explanation.

You'll have to

let g:AutoPairsMapCR = 0
inoremap <silent><expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<C-g>u\<CR><C-r>=AutoPairsReturn()\<cr>"

Finally reproduced it. Looks like both SNRs are invoked, which sounds like the most plausible explanation.

You'll have to


let g:AutoPairsMapCR = 0

inoremap <silent><expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<C-g>u\<CR><C-r>=AutoPairsReturn()\<cr>"

Great! It's gone.

dr0bz commented

@LunarWatcher Thank you very much. I had this issue as well.