LanguageClient-neovim
LanguageClient-neovim copied to clipboard
[feature request] switch language server for different projects
First of all, thank you for developing great tool!
Is your feature request related to a problem? Please describe.
We can use only one language server with each filetype.
Describe the solution you'd like
Sometimes, one language has some language servers or running server options.
For example, we can run rls aka rust language server with both rustup run stable rls
and rustup run nightly rls
and more.. .
I want to switch to other lsp depending on project.
Describe alternatives you've considered
Now I write vimscript like this.
function! SwitchStableRls() abort
if (&ft=='rust')
LanguageClientStop
sleep 100m
let g:LanguageClient_serverCommands.rust = ['rustup', 'run', 'stable', 'rls']
LanguageClientStart
endif
endfunction
function! SwitchNightlyRls() abort
if (&ft=='rust')
LanguageClientStop
sleep 100m
let g:LanguageClient_serverCommands.rust = ['rustup', 'run', 'nightly', 'rls']
LanguageClientStart
endif
endfunction
Would we add more generic API than above script?
why not simply use exrc?
simply put a .vimrc / .nvimrc file in your project root and put the specific config in there.
that or define your rustup mode in an environment variable
let g:LanguageClient_serverCommands.rust = ['rustup', 'run', $RUSTUP_MODE, 'rls']
this is how i handle my various pyls configs.