roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

Completion shows part of the snippet #221

Open MichaelWJung opened 6 years ago

MichaelWJung commented 6 years ago

The following gif explains my problem best: completion

When I go through the list of available completions I will always see part of the snippet code in the buffer. As soon as I press the completion keys, UltiSnips is triggered correctly, though. This is kind of annoying if I don’t want to use snippets in some situations. Is this a known issue? Anything I’m doing wrong here?

I use neovim v0.2.2 on Linux with the cquery language server. All plugins are up to date. I can reproduce the issue with the following minimal init.vim:

call plug#begin('~/.local/share/nvim/plugged')
Plug 'autozimu/LanguageClient-neovim', {
    \ 'branch': 'next',
    \ 'do': 'bash install.sh',
    \ }
Plug 'roxma/nvim-completion-manager'
Plug 'SirVer/ultisnips'
call plug#end()

let g:UltiSnipsSnippetsDir = $HOME."/.config/nvim/UltiSnips/"
let g:UltiSnipsJumpForwardTrigger = "<C-J>"
let g:UltiSnipsJumpBackwardTrigger = "<C-K>"

let g:UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"
inoremap <silent> <c-j> <c-r>=cm#sources#ultisnips#trigger_or_popup("\<Plug>(ultisnips_expand)")<cr>

inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")

let g:LanguageClient_settingsPath = $HOME.'/.config/nvim/settings.json'
let g:LanguageClient_serverCommands = { 'cpp': ['cquery', '--language-server'] }
let g:LanguageClient_loadSettings = 1
MichaelWJung commented 6 years ago

The following change fixes the problem, but I have no idea if this is really the right way to do it: https://github.com/MichaelWJung/nvim-completion-manager/commit/6733f39818a3c9c3bca26e76704ebd2a08a5d96d