lsp-java icon indicating copy to clipboard operation
lsp-java copied to clipboard

Multiple workspaces with separated config/cache directories

Open dschrempf opened this issue 2 years ago • 6 comments

Hi!

I am used to running separate language servers for separate projects (==workspaces in jdtls language?) in one Emacs session. Is this possible with lsp-java and jdtls? I can configure lsp-java to load one workspace, then restart Emacs (and kill all remaining java daemons/processes), then load another workspace.

However, when I load two workspaces in one Emacs session the newly loaded workspace is added to the other jdtls instance, instead of running a new instance.

Is it possible to have serparate jdtls instances serving separate workspaces at the same time?

Thank you for your help.

dschrempf avatar Mar 13 '23 17:03 dschrempf

At this point, this is not possible, because lsp-java, dap-java are expecting a single jdtls instance.

yyoncho avatar Mar 13 '23 17:03 yyoncho

Thank you for your reply. So how would one then work with two projects and different Java installations? I read something about lsp-save-vscode-workspace but I have no idea how this works.

dschrempf avatar Mar 13 '23 17:03 dschrempf

you mean different java versions? IOW what is the problem you are trying to solve

yyoncho avatar Mar 13 '23 17:03 yyoncho

I am trying to develop projects with different versions of jdtls and different versions of the jdk in the same Emacs session.

dschrempf avatar Mar 13 '23 19:03 dschrempf

The different versions of the jdk can be controlled by https://github.com/emacs-lsp/lsp-java/issues/254#issuecomment-665851027

Why do you need different jdtls versions?

yyoncho avatar Mar 14 '23 05:03 yyoncho

Thanks for your replies! The links are really informative, and the suggestions worked. I think this should be documented in the project readme but I understand that this is a lot of work.

The only worry I still have is that all projects use the same -configurtion and -data directories (as well as the same lsp-java-workspace-cache-dir). jdtls recommends having separate folders. See, e.g., https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line.

dschrempf avatar Mar 14 '23 12:03 dschrempf