Shougo / neosnippet.vim

neo-snippet plugin
Other
1.12k stars 108 forks source link

Completion with LanguageClient-Neovim and deoplete errors with "Key not present in Dictionary: word" #480

Closed I-Al-Istannen closed 4 years ago

I-Al-Istannen commented 4 years ago

Introduction

Hey, maybe I missed something but recently autocompletion from LanguageClient-Neovim does no longer work properly. I am creating the issue here, as the error log only mentions neosnippet.

Textual description

Completion works, but trying to expand a snippet (or any placeholder in it), yields to an error saying E716: Key not present in Dictionary: word

clangd is just an example, it also fails with haskell and probably every other LS.

Gif description

Neosnippet_Fun_Minimal

Mostly minimal nvim.vim


" vim: foldmethod=marker ft=vim :
if &compatible
  set nocompatible               " Be iMproved
endif

" Required:
set runtimepath+=~/.vim/dein/repos/github.com/Shougo/dein.vim

" Dein {{{
" Required:
if dein#load_state('~/.vim/dein')
  call dein#begin('~/.vim/dein')

  " Let dein manage dein
  " Required:
  call dein#add('~/.vim/dein/repos/github.com/Shougo/dein.vim')

  " Add Plugins {{{
  call dein#add('Shougo/deoplete.nvim')
  call dein#add('Shougo/neosnippet.vim')

  " LSP
  call dein#add('autozimu/LanguageClient-neovim', {
    \ 'rev': 'next',
    \ 'build': 'bash install.sh',
    \ })

  " }}}

  " Required:
  call dein#end()
  call dein#save_state()
endif
" }}}

let g:deoplete#enable_at_startup = 1

"" Expand with tab otherwise complete. Code taken from README
imap <expr><TAB> pumvisible() ? "\<C-n>" : (neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>")

let g:LanguageClient_serverCommands =
      \ {
      \ 'c': ['clangd', '--suggest-missing-includes', '--clang-tidy'],
      \ }

filetype plugin indent on
syntax enable

Test file

#include <stdio.h>

int main() {
    printf
}

Complete twice at printf. Once to expand, once to replace the placeholders. The second time fails with the stated error.

Parting words

I hope this report included everything you need and maybe you are able to point me in the right direction :) My knowledge of vimscript or vim's internals is sadly quite limited. I apologize, if I have just glossed over some manual or FAQ entry that explains my issue, but I tried to search for all variations of the error message I could come up and turned up empty. Nevertheless, it is quite possible I have missed something obvious.

Enjoy your day :)

Shougo commented 4 years ago

Thanks. Fixed.

I-Al-Istannen commented 4 years ago

Thank you! Have a day/night! :)