Closed hrsh7th closed 4 years ago
What language server did you test this on? Snippets no longer work with clangd on my machine.
I tested on vim-language-server. Sorry, I will try re-check.
I'm re-check on vim-language-server and it works well.
My checked steps are below.
hrsh7th/vim-lsp-snippets
and hrsh7th/vim-lsp-ultisnips
both.let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
<Tab>
.I try to use clangd
to the next step. (Sorry, I had not use clang
and clangd
both).
I finally found the reason that is not work when using clangd. https://github.com/thomasfaingnaert/vim-lsp-snippets/pull/5/files#diff-b7178f84627eaeaf3f08efb74ae5d1d5L19
The reason is that it was removed trim
.
I think this trimming should be in vim-lsp side.
Could you tell me the your opinion about it?
trimming has merged in vim-lsp. I checked and worked well on clangd. Could you check with latest vim-lsp and this PR?
I tested again, still no success :( It's not specific to clangd: vim language server doesn't work either.
I did some digging and I found that l:managed_user_data
is empty.
This results in lsp_expand_snippet
not being called.
Any idea why that may be?
diff --git a/autoload/lsp/ui/vim/completion.vim b/autoload/lsp/ui/vim/completion.vim
index 342d5c5..fa36fd4 100644
--- a/autoload/lsp/ui/vim/completion.vim
+++ b/autoload/lsp/ui/vim/completion.vim
@@ -34,6 +34,8 @@ function! s:on_complete_done() abort
" Clear managed user_data.
call lsp#omni#_clear_managed_user_data_map()
+ call lsp#log('l:managed_user_data', l:managed_user_data)
+
" If managed user_data does not exists, skip it.
if empty(l:managed_user_data)
doautocmd User lsp_complete_done
Mon 13 Jan 2020 17:47:56 CET:["l:managed_user_data",{}]
Currently, vim-lsp-snippets and vim-lsp-ultisnips seem to still work on the latest vim-lsp. What would the advantage be to use g:lsp_snippet_expand
?
Thanks and Sorry for your time.
I did some digging and I found that l:managed_user_data is empty. This results in lsp_expand_snippet not being called. Any idea why that may be? It seems same to https://github.com/prabirshrestha/vim-lsp/issues/668.
Currently, vim-lsp-snippets expects vim-lsp/textEdit
in user_data.
But the key was removed ... So I sent the PR.
g:lsp_snippet_expand
has no big advantage it only make easy to integration.
I will try to solve https://github.com/prabirshrestha/vim-lsp/issues/668. I'm very sorry but I will ask you to check after fix.
The PR has merged now (https://github.com/prabirshrestha/vim-lsp/pull/669). I prepare the below environment and checked snippets on clangd.
hrsh7th/vim-lsp-snippets
hrsh7th/vim-lsp-ultisnips
sirver/ultisnips
prabirshrestha/vim-lsp
#masterlet g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-l>"
let g:UltiSnipsJumpBackwardTrigger="<c-h>"
sample.c
sprint<C-x><C-o>
sprintf
candidate and confirm itWorks perfectly. Thanks for taking the time to look into this! Also congrats on being made contributor on vim-lsp :smile:
This is same to https://github.com/thomasfaingnaert/vim-lsp-neosnippet/pull/1