thomasfaingnaert / vim-lsp-snippets

Language Server Protocol snippets in vim using vim-lsp
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

vim-lsp-snippets breaks with ccls after vim-lsp merge #637 #6

Closed d-karl closed 4 years ago

d-karl commented 4 years ago

Hi, I have a problem using: ncm2 vim-lsp vim-lsp-snippets vim-lsp-ultisnips working with the ccls server to edit c++.

After the merge of https://github.com/prabirshrestha/vim-lsp/pull/637 (commit https://github.com/prabirshrestha/vim-lsp/commit/f769a450b2b96d517610f0e69408c2ebd5cb4214) into vim-lsp, vim-lsp no longer provies any auto completions using the above combination while editing c++ using ccls. Using vim-lsp with pyls still works correctly and supplies auto completion items, which can be expanded into snippets. I have determined the problematic commit using bisect, the previous commit on master works.

I have checked vim-lsp log, and completion items are retrived just fine. Something else later down the chain breaks. Disabling vim-lsp-snippets gives me back completion items, but obviously does not allow me to expand completion items as snippets. I hope I am in the right place to report this and would love to help any way I can!

thomasfaingnaert commented 4 years ago

@hrsh7th Can you help debug this issue? I'm wondering if this is the same problem as I had in https://github.com/thomasfaingnaert/vim-lsp-ultisnips/pull/9.

thomasfaingnaert commented 4 years ago

@d-karl To help with debugging, can you add some lsp#log statements, say https://github.com/thomasfaingnaert/vim-lsp-snippets/blob/master/autoload/lsp_snippets.vim#L18 here to see if that function is still called? Also, could you post your vim-lsp log, there might be some errors in there that might give a clue to what is going wrong.

hrsh7th commented 4 years ago

@d-karl Thanks for your report.

Could you tell me whether you using ncm2-vim-lsp?

I think the problem needs below steps to solve.

  1. Merge https://github.com/prabirshrestha/vim-lsp/pull/669
  2. Merge https://github.com/thomasfaingnaert/vim-lsp-snippets/pulls
  3. Support new vim-lsp in ncm2-vim-lsp.

I will create PR for ncm2-vim-lsp to support new vim-lsp completion approach.

d-karl commented 4 years ago

Thank you for invesitgating. I can confirm I am using ncm2-vim-lsp.

Regarding uploading logs, I'll have to reproduce the issue on my personal machine first then get you logs from there. I can not give you logs from my work machine.

yaegassy commented 4 years ago

Same problem

I have the same problem with gopls.

hrsh7th/vim-lsp-snippets + hrsh7th/vim-lsp-ultisnips will work fine.

Minimal vimrc

[OK] check-hrsh7th.vimrc

Use: hrsh7th/vim-lsp-snippets and hrsh7th/vim-lsp-ultisnips.

call plug#begin('~/.vim/plugged-hrsh7th')
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'hrsh7th/vim-lsp-snippets'
Plug 'hrsh7th/vim-lsp-ultisnips'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
call plug#end()

let g:lsp_log_file = expand('/tmp/vim-lsp-snippets-hrsh7th.log')
let g:lsp_diagnostics_enabled = 0

if executable('gopls')
  augroup LspGo
    au!
    au User lsp_setup call lsp#register_server({
        \ 'name': 'gopls',
        \ 'cmd': {server_info->['gopls']},
        \ 'whitelist': ['go'],
        \ 'workspace_config': {
        \   'gopls': {
        \     'usePlaceholders': v:true,
        \   }
        \ }})
    au FileType go setlocal omnifunc=lsp#complete
  augroup end
endif

imap <c-j> <c-r>=UltiSnips#JumpForwards()<CR>
smap <c-j> <c-r>=UltiSnips#JumpForwards()<CR>
imap <c-k> <c-r>=UltiSnips#JumpBackwards()<CR>
smap <c-k> <c-r>=UltiSnips#JumpBackwards()<CR>

[NG] check-thomasfaingnaert.vimrc

Use: thomasfaingnaert/vim-lsp-snippets and thomasfaingnaert/vim-lsp-ultisnips.

call plug#begin('~/.vim/plugged-thomasfaingnaert')
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'thomasfaingnaert/vim-lsp-snippets'
Plug 'thomasfaingnaert/vim-lsp-ultisnips'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
call plug#end()

let g:lsp_log_file = expand('/tmp/vim-lsp-snippets-thomasfaingnaert.log')
let g:lsp_diagnostics_enabled = 0

if executable('gopls')
  augroup LspGo
    au!
    au User lsp_setup call lsp#register_server({
        \ 'name': 'gopls',
        \ 'cmd': {server_info->['gopls']},
        \ 'whitelist': ['go'],
        \ 'workspace_config': {
        \   'gopls': {
        \     'usePlaceholders': v:true,
        \   }
        \ }})
    au FileType go setlocal omnifunc=lsp#complete
  augroup end
endif

imap <c-j> <c-r>=UltiSnips#JumpForwards()<CR>
smap <c-j> <c-r>=UltiSnips#JumpForwards()<CR>
imap <c-k> <c-r>=UltiSnips#JumpBackwards()<CR>
smap <c-k> <c-r>=UltiSnips#JumpBackwards()<CR>

Demo

demo-vim-lsp-snippets

Log (vim-lsp-snippets-thomasfaingnaert.log)

Error topic

水  1/15 21:32:44 2020:["s:on_stdout client request on_notification() error","Vim(let):E716: Key not present in Dictionary: vim-lsp/textEdit","function lsp#complete[1]..lsp#omni#complete[22]..<SNR>38_out_cb[2]..<SNR>37_on_stdout[79]..<lambda>44[1]..<SNR>40_handle_omnicompletion[11]..<SNR>40_get_completion_result[14]..<lambda>62[1]..lsp#omni#get_vim_completion_item[1]..lsp_snippets#get_vim_completion_item, line 18"]
d-karl commented 4 years ago

After seeing the errror @yaegassy gets in the log, I realized my log also contains an error message, althought it is a different one:

Tue 14 Jan 2020 05:55:12 PM CET:["s:on_stdout client request on_notification() error", "Vim(let):E474: Unidentified byte: vim-lsp/key/12", "function <SNR>205_on_stdout[4]..<SNR>204_on_stdout[79]..<lambda>138[1]..<SNR>93_on_completion_result[17]..lsp#omni#get_vim_completion_item[1]..lsp_snippets#get_vim_completion_item, line 15"]

Again, sorry for not providing the whole log yet.

thomasfaingnaert commented 4 years ago

@yaegassy I've merged the PRs. Can you confirm your issue has been fixed?

thomasfaingnaert commented 4 years ago

@d-karl The way vim-lsp handles user_data was recently changed. Can you update your plugins and check if the issue has been solved with the latest vim-lsp-ultisnips and vim-lsp-snippets?

yaegassy commented 4 years ago

This problem has been resolved. Thanks! works fine for me!

hrsh7th commented 4 years ago

I sent PR to vim-lsp.

After merged the PR, I will sent PR to ncm2-vim-lsp. If those PRs merged, the problem will solve maybe.

d-karl commented 4 years ago

Can also confirm the newest versions of: 'prabirshrestha/vim-lsp' 'thomasfaingnaert/vim-lsp-snippets' 'thomasfaingnaert/vim-lsp-ultisnips' have fixed the issue for me. I don't know if changes to ncm2-vim-lsp are necessary, the current version is working for me.

hrsh7th commented 4 years ago

Hm... IMO, snippet feature does not work on currently ncm2-vim-lsp... (because it overwrites user_data).

Although, your environment works fine is good. Thanks for your reporting.

thomasfaingnaert commented 4 years ago

Great. Thanks to everyone involved in getting to the bottom of this.