completion-nvim
completion-nvim copied to clipboard
'completion_auto_change_source' and 'completion_chain_complete_list' select item automatically
My testing minimal init.vim
set runtimepath^=~/.local/share/nvim/site/pack/packer/opt/nvim-lspconfig
set runtimepath^=~/.local/share/nvim/site/pack/packer/opt/completion-nvim
set runtimepath^=~/.local/share/nvim/site/pack/packer/opt/vim-vsnip
set runtimepath^=~/.local/share/nvim/site/pack/packer/opt/vim-vsnip-integ
imap <silent> <c-space> <Plug>(completion_trigger)
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
autocmd BufEnter * lua require'completion'.on_attach()
let g:completion_auto_change_source = 1
let g:completion_chain_complete_list = [
\{'complete_items': ['path'], 'triggered_only': ['/']},
\{'complete_items': ['lsp', 'buffers']},
\{'mode': '<c-p>'},
\{'mode': '<c-n>'}
\]
lua << EOF
local lspconfig = require 'lspconfig'
local root_pattern = lspconfig.util.root_pattern
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
lspconfig.jdtls.setup{
root_dir = root_pattern(".git"),
capabilities = capabilities,
}
EOF
Description Two issues are happening (although, I believe they are the same?). When the above two options are set:
- The word being deleted with backspace is automatically completed.
- Cycling through the completion menu inserts an item automatically (thus preventing from choosing another).
How to reproduce
- Create file
Main.java
with:
public class Main {
public static void main(String[] args) {
String foo = "Hello, World";
}
}
-
After line "foo", insert
f
: a list is suggested:float
,foo
,for
,foreach
,fori
,ftdetect
. -
Cycle through the suggestions with
<Tab>
, when passing throughforeach
, the item is inserted.
Otherwise, it can be reproduced by completing the variable foo.
, cycle through available methods until the cursor reaches a method with available snippets.
Another issue (maybe with the same origin?): type final
, then delete the last character l
: the word fina
is automatically completed to final
.