vim-lsc icon indicating copy to clipboard operation
vim-lsc copied to clipboard

Example for switching Language Servers

Open mikepjb opened this issue 5 years ago • 3 comments

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,
    \   },
    \ }

mikepjb avatar Jan 30 '20 21:01 mikepjb

Vim-lsc is a great plugin but it still lacks a lot of languages in the documentation. Can you add the configuration for Tailwind?

ghost avatar Aug 28 '20 09:08 ghost

Hi Cauryl, I'd be happy to - do you know where in the codebase I should add it?

mikepjb avatar Sep 04 '20 07:09 mikepjb

You can add it to the wiki. Feel free to complete the wiki with other examples and languages.

ghost avatar Sep 14 '20 09:09 ghost