skip to Main Content

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?

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search