Open jsit opened 4 years ago
The value of data
being passed here seems to have duplicate values in some cases:
I don't have an answer and I'm still a noob at Vim, but I wanted to +1. I've been seeing the same thing and chalked it up to my configurations being hacked together with duct tape.
It wasn't until today when I realized there's something more fundamental going on after trying to use LspCodeAction
and was getting duplicate results:
(This is happening almost across the board, I would say. For example, my diagnostics do the same thing)
This is my current configuration -- everything else I pretty much copied from vim-lsp
.
if executable('rust-analyzer')
au User lsp_setup call lsp#register_server({
\ 'name': 'Rust Analyzer',
\ 'cmd': {server_info->['rust-analyzer']},
\ 'whitelist': ['rust'],
\ 'initialization_options': {
\ 'checkOnSave': { 'command': 'clippy', 'enable': v:true },
\ },
\ })
endif
What I noticed is one of the results comes from the name
setting, and the other from rust-analyzer
. Maybe it's of no consequence :man_shrugging: Just pattern matching over here.
P.S. -- if I can help improve the tool with my limited experience, please let me know. Happy to try!
P.P.S. -- Changing the name
key to match rust-analyzer
fixed this problem for me! Holy cow! I enabled logging to catch the logs as they were happening. I now no longer see duplicates in practice as well. I guess it's noteworthy a lot of the non-rust examples I looked at gopls
and pylsp
used matching values! Configuration now looks like this
if executable('rust-analyzer')
au User lsp_setup call lsp#register_server({
\ 'name': 'rust-analyzer',
\ 'cmd': {server_info->['rust-analyzer']},
\ 'whitelist': ['rust'],
\ 'initialization_options': {
\ 'checkOnSave': { 'command': 'clippy', 'enable': v:true },
\ },
\ })
endif
Doesn't seem to happen when you first start typing something; only after going into insert mode, then back into normal mode, then back into insert mode again.
Minimal .vimrc:
Replaces prabirshrestha/vim-lsp#894