Example for switching Language Servers
This snippet allows you to swap between languages servers:
function! SwapLanguageServer(config)
LSClientDisable
for [filetype, config] in items(a:config)
call RegisterLanguageServer(filetype, config)
endfor
LSClientEnable
endfunction
command! Tailwind :call SwapLanguageServer(g:tailwind_server_config)
command! JS :call SwapLanguageServer(g:javascript_server_config)
I found it useful but haven't seen a recommended way for doing this - perhaps you'd like to have something like this in the docs?
Let me know, I'd be happy to write it in myself
As an alternate suggestion, perhaps including an additional key in language configurations and a :LSAlternate command would work better for switching between them e.g:
let g:lsc_server_config = {
\ 'javascript': {
\ 'command': 'javascript-typescript-stdio',
\ 'alternate': 'tailwind-language-server --stdio',
\ 'suppress_stderr': v:true,
\ },
\ }
Vim-lsc is a great plugin but it still lacks a lot of languages in the documentation. Can you add the configuration for Tailwind?
Hi Cauryl, I'd be happy to - do you know where in the codebase I should add it?
You can add it to the wiki. Feel free to complete the wiki with other examples and languages.