roxma / nvim-completion-manager

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

Selecting snippets fails #196

Closed hliebert closed 6 years ago

hliebert commented 6 years ago

I've been getting the following error for about a week when selecting a snippet, both in Latex and R. I'm using UltiSnips together with nvim-completion-manager in Vim 8 on Linux.

The culprit seems to be let g:UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"

xrayw commented 6 years ago

+1

kodemeister commented 6 years ago

Same for me. The errors started appearing after upgrading from Vim 8.0.1436 to 8.0.1476. Seems like v:completed_item variable is now fully read-only. This works in Neovim 0.2.2 but not in the latest Vim:

let v:completed_item.snippet = "foo"
Shougo commented 6 years ago

nvim-completion-manager should use user_data feature instead.

JR4er commented 6 years ago

The ugly fix in PR #200 works for me with vim + ultisnips. Neosnippets and Snipmates are not tested.

qazip commented 6 years ago

I'm having this issue as well. Is this going to be fixed anytime soon? It's a deal breaker!

qazip commented 6 years ago

@roxma, are you going to accept JR4er PR?

JR4er commented 6 years ago

@qazip you can use my fork JR4er/nvim-completion-manager as a temporary solution until a better fix is provided or the PR is accepted. (my fork will be removed then)

qazip commented 6 years ago

@JR4er , sadly your fork doesn't seem to work with vim-Plug. I'll have to find another way to install it. thanks!

JR4er commented 6 years ago

@qazip I use vim-Plug too. Plug 'JR4er/nvim-completion-manager' works for me.

qazip commented 6 years ago

@JR4er, I was missing PlugClean, my bad. Though there seems to be an error now, when opening gvim: http://i.imgur.com/yocvqfC.png

Probably due to using vim-hug-neovim-rpc?

JR4er commented 6 years ago

@qazip likely. You still need to install roxma/vim-hug-neovim-rpc and use pip to install neovim python-client, see the Installation section in README.md

qazip commented 6 years ago

@JR4er, I did install that. It works fine in vim, in GVim it gives the error I showed you.

ikalnytskyi commented 6 years ago

😢

chemzqm commented 6 years ago

Actually you can just not rely NCM to do the snip complete for you, for exmaple, I have these code in my .vimrc:

" improved ultisnip complete {{
inoremap <C-l> <C-R>=SnipComplete()<CR>
func! SnipComplete()
  let line = getline('.')
  let start = col('.') - 1
  while start > 0 && line[start - 1] =~# '\k'
    let start -= 1
  endwhile
  let suggestions = []
  let snips =  UltiSnips#SnippetsInCurrentScope(0)
  for item in snips
    let trigger = item.key
    let entry = {'word': item.key, 'menu': item.description}
    call add(suggestions, entry)
  endfor
  if empty(suggestions)
    echohl Error | echon 'no match' | echohl None
  elseif len(suggestions) == 1
    let pos = getcurpos()
    if start == 0
      let str = trigger
    else
      let str = line[0:start - 1] . trigger
    endif
    call setline('.', str)
    let pos[2] = len(str) + 1
    call setpos('.', pos)
    call UltiSnips#ExpandSnippet()
  else
    call complete(start + 1, suggestions)
  endif
  return ''
endfunc
" }}
ikalnytskyi commented 6 years ago

And I can just don't use NCM as well, but that's not an option. :) I don't want to maintain hacks and workarounds, and it's pity that @roxma don't have enough time to work on this.

roxma commented 6 years ago

ncm2 fixes this issue. use ncm2 instead http://github.com/ncm2/ncm2