LanguageClient-neovim icon indicating copy to clipboard operation
LanguageClient-neovim copied to clipboard

String interpolation of rootPath in serverCommands

Open languitar opened this issue 7 years ago • 1 comments

Looking again at an issue I had with the java language server (https://github.com/eclipse/eclipse.jdt.ls/issues/622#issuecomment-382719309) it seems that I need a way to expand the project root path used for starting a server into it's command line to specify it workspace (a kind of working directory that should be unique to the project I am working on).

Describe the solution you'd like

I would need something like the following:

let g:LanguageClient_serverCommands={
    \ 'java': ['jdtls', '-data', '/home/languitar/.local/share/nvim/ls/java/%r'],

where %r is something that uniquely identifies the discovered root path in way that it can be used as a stable folder name.

Describe alternatives you've considered

Without this option, I will have to override the serverCommand manually for each java project using something like an .exrc file, which is a lot of work and can easily be forgotten.

languitar avatar Nov 07 '18 10:11 languitar

I know this is terribly late but doesn't this solve your issue?

let g:LanguageClient_serverCommands = {
    \ 'java' : ['jdtls', '-data', '/home/languitar/.local/share/nvim/ls/java' . expand('%r')],
    \ }

That may not be exactly the same project root that LCN ends up using, but I feel like that should be unique enough?

martskins avatar Nov 08 '20 18:11 martskins