When using multiple LSP servers for the same file type, one of which provides completions/auto-imports, and when working with multiple buffers (using set hidden), an auto-import may trigger twice.
Setup. I am using the following vimrc with VIM 9.1.16, not using any packages besides lsp:
As you can see, I am using pyright together with a second language server defined for the python file type, which does not really do anything in this case.
Steps to reproduce. Open a new python file using vim foo.py and type some text (e.g. get_cache_) and accept the auto-import suggestion. The function get_cache_token is imported once as expected. Now open a second buffer with :e bar.py and then do the same thing (type get_cache_ and accept the auto-import suggestion). Now the same function is imported twice.
Some notes:
When the second language server is not present, the issue does not appear.
Although the example above uses pyright/efm-langserver, I can reproduce the same issue with other combinations of LSP servers (I have also tested pyright/pylsp and typescript-language-server/efm-langserver for the typescript filetype). So this seems like it is not connected to a particular LSP server.
When using multiple LSP servers for the same file type, one of which provides completions/auto-imports, and when working with multiple buffers (using
set hidden
), an auto-import may trigger twice.Setup. I am using the following
vimrc
with VIM 9.1.16, not using any packages besideslsp
:As you can see, I am using
pyright
together with a second language server defined for the python file type, which does not really do anything in this case.Steps to reproduce. Open a new python file using
vim foo.py
and type some text (e.g.get_cache_
) and accept the auto-import suggestion. The functionget_cache_token
is imported once as expected. Now open a second buffer with:e bar.py
and then do the same thing (typeget_cache_
and accept the auto-import suggestion). Now the same function is imported twice.Some notes:
typescript
filetype). So this seems like it is not connected to a particular LSP server.I believe this is a different issue than #522.