nvim-lua / completion-nvim

A async completion framework aims to provide completion to neovim's built in LSP written in Lua
Apache License 2.0
975 stars 79 forks source link

Random autocompletion in pop-up menu with lsp when setting "completion_trigger_keyword_length" #335

Open coxackie opened 3 years ago

coxackie commented 3 years ago

My testing minimal init.vim

" Spelling
set spell spelllang=en_gb
set complete+=kspell

" Completion stuff
set completeopt=menuone,noinsert,longest
set shortmess+=c

let g:completion_trigger_on_delete = 1
let g:completion_trigger_keyword_length = 3
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
let g:completion_auto_change_source = 1
let g:completion_chain_complete_list = [
    \{'complete_items': ['lsp']},
    \{'mode': '<c-p>'},
    \{'mode': '<c-n>'}
\]
" Set up auto-completion on every buffer
autocmd BufEnter * lua require'completion'.on_attach()

(The completion list is remnant of my full init when I use lsp, but the issue I am describing persists with this minimal init and no other plugins except completion-nvim. You can try it with or without the nvim-lspconfig plugin)

How to reproduce Start typing (for example, in a plain text file), after 3 letters the pop-up menu appears, start going down the list with . At some random point in time, the thing gets auto-completed where the selections is. (If this does not happen at the first word, continue and try another.) That is, it does not wait until I press or . The funny thing is, if I remove let g:completion_trigger_keyword_length = 3, or the \{'complete_items': ['lsp']} this stops happening. Now, the problem is that I do want the lsp completion to happen, so I do not want to remove it.

Expected behavior I would be expecting that setting g:completion_trigger_keyword_length or having lsp as first completion source would not have any weird buggy effect while at the pop-up menu.

coxackie commented 3 years ago

ok, I see no response. I am going to leave this here for posterity, in case someone ever reads it. Anyway, moving on to a different auto-completion plugin.