Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
d-karl opened this issue Jan 14, 2020 · 13 comments
Closed

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

d-karl opened this issue Jan 14, 2020 · 13 comments
Labels
bug Something isn't working

Comments

@d-karl
Copy link

d-karl commented Jan 14, 2020

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 prabirshrestha/vim-lsp#637 (commit prabirshrestha/vim-lsp@f769a45) 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
Copy link
Owner

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

@thomasfaingnaert
Copy link
Owner

@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
Copy link
Contributor

hrsh7th commented Jan 14, 2020

@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 Fix #668 prabirshrestha/vim-lsp#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
Copy link
Author

d-karl commented Jan 15, 2020

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
Copy link

yaegassy commented Jan 15, 2020

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
Copy link
Author

d-karl commented Jan 15, 2020

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
Copy link
Owner

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

@thomasfaingnaert
Copy link
Owner

@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?

@thomasfaingnaert thomasfaingnaert added the bug Something isn't working label Jan 15, 2020
@yaegassy
Copy link

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

@hrsh7th
Copy link
Contributor

hrsh7th commented Jan 16, 2020

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
Copy link
Author

d-karl commented Jan 16, 2020

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
Copy link
Contributor

hrsh7th commented Jan 16, 2020

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants