1

I have multiple projects (git-repos). I have opened these in one multi-root workspace using Add Folder to Workspace.... Since these are all Clojure projects, and I have Calva installed, VSCode identified the correct LSP server clojure-lsp. But VS Code starts one LSP server for each folder/project in my multi-root workspace. I want only one.

How can I tell VS Code to start only one LSP server for all folders in my workspace?

starball
  • 20,030
  • 7
  • 43
  • 238
Witek
  • 6,160
  • 7
  • 43
  • 63

2 Answers2

0

At the time of this writing, this is not supported. See multi root support? #280. If you look at their projects page, that issue ticket is currently placed in the "Low priority" lane.

You can show your support for the issue ticket by giving a thumbs up reaction to the issue. But please don't make a "me too" comment. "me too" comments generally come off as annoying to repo maintainers because they clutter up discussion and don't contribute anything of significant value.

Some quotes from the discussion there:

lucywang000:

I noticed that python's pyright lsp only fires up one instance for multiple python projects, would it make sense to have a similar feature in clojure-lsp?

Some related quote from the doc (https://github.com/microsoft/pyright/blob/master/docs/configuration.md):

Multi-root workspaces (“Add Folder to Workspace…”) are supported, and each workspace root can have its own “pyrightconfig.json” file.

I used to open lots (5-10) of clojure/script projects, for e.g reading 3rdparty libs code. It doesn't make sense to have 10 lsp instances running and take up to 10-20GB of memory ...

ericdallo:

Yeah, it sound a good idea, but I'm not sure this works for most of clients, including lsp-mode (lsp-clojure.el), it'd need some extra work on their side, and I'm no sure what need to be done on server side too

bpringe:

I was thinking about this recently. I think this is a good idea, though I know it might take some time and thought to implement well.

bpringe:

Another thing to consider is that if the memory usage of clojure-lsp can be drastically reduced via graalvm and other methods, this becomes less of a problem. I still think it's a worthwhile thing to do in any case, though.

Edit: Linking #229

snoe

I know some workplaces do multi repo/multi project/multi language stuff but it should be understood there's costs there, particularly around tooling support and it should be clear that those places should be investing in their tools.

I think that comparing ourselves to things like intellij or vscode backed by huge companies and hundreds of devs is a losing proposition.

So, in the end, my view is that collaboration and PRs can be welcome, but understand there's a high effort to maintain compatibility and performance and stability across servers and clients and to do the testing across those environments.

starball
  • 20,030
  • 7
  • 43
  • 238
  • I have managed to configure multiple projects with only one clojure-lsp in Emacs. I am asking here if this is also possible in VSCode. – Witek Feb 14 '23 at 20:48
  • @Witek And I am telling you that according to discussion by the clojure-lsp maintainers, it is currently not configurable by users. That issue ticket is in reference to VS Code's multi-root workspaces feature. Isn't that exactly what your question is about? – starball Feb 14 '23 at 20:50
  • I hoped for a creative solution. Like opening only one folder and linking / symlinking the others. Or blacklisting the start of LSP server for some folders like I did in Emacs. Or whatever is the way hacks are done in VS Code.... – Witek Feb 15 '23 at 09:46
0

To make one clojure-lsp serve all folders in your workspace, you can use a single deps.edn file at the top level that references the other projects as local dependencies.

Clojure-lsp's repo is an example of this. If I open this repo in Calva version 2.0.337 (the latest version at the time of this writing), only one clojure-lsp server is started.

Brandon
  • 91
  • 1
  • 6