Skip to content

Advanced Workspace folders support #1352

Closed

Description

@lin-qingying
No description provided.

Activity

  1. angelozerr commented on Oct 28, 2025

    @angelozerr
    Contributor

    Today you need to declare your language server with extension point and basicly it creates one instance of language server wrapper.

    What is your usecase?

  2. lin-qingying commented on Oct 28, 2025

    @lin-qingying
    ContributorAuthor
    Image I need to create a language server for each individual project, their directories are independent, but only one can be created through extension points
  3. lin-qingying commented on Oct 28, 2025

    @lin-qingying
    ContributorAuthor

    For example, can you add a servers extension point that returns a List

  4. angelozerr commented on Oct 28, 2025

    @angelozerr
    Contributor

    Today it is not possible and I think it is not a trivial issue

  5. lin-qingying commented on Oct 28, 2025

    @lin-qingying
    ContributorAuthor

    Thank you for your answer, I will change my implementation to meet my requirements

  6. angelozerr commented on Oct 28, 2025

    @angelozerr
    Contributor

    If vscode can manage this usecase I will agree to implement that otherwise I dont want to implement something which doesnt work for other lsp clients

  7. angelozerr commented on Oct 28, 2025

    @angelozerr
    Contributor

    Thank you for your answer, I will change my implementation to meet my requirements

    I think the main idea is to implement a robust server with vscode and after that all lsp clients should work or should be improved to be aligned with vscode

  8. angelozerr commented on Oct 31, 2025

    @angelozerr
    Contributor

    @lin-qingying can we close this issue?

  9. pddshk commented on Mar 24, 2026

    @pddshk

    If vscode can manage this usecase I will agree to implement that otherwise I dont want to implement something which doesnt work for other lsp clients

    Actually neovim works like so when dealing with python projects: it walks up dir-by-dir from currently open file looking for pyporject.toml or pyrightconfig.toml or whatever configuration file LS requires to start and start LS in the location of it's config

    so that it can start several severs given a layout like so

    client/someLSPconfig.toml
    common/someLSPconfig.toml
    server/someLSPconfig.toml

    3 servers each one for each project, but it only starts server if a file in corresponding project is open

    So in case described above this looks like a good improvement for teams with monorepos -- they don't need top manage configs per-developer

  10. angelozerr commented on Mar 24, 2026

    @angelozerr
    Contributor

    @pddshk if I understand correctly your explanation, you can defines some language servers for a given folder, right?

    If it that an idea that I had is to host language server configuration in a .lsp4ij folder that you can set in the project root or ona given folder (according your need).

    The .lsp4ij will look liks this :https://github.com/redhat-developer/lsp4ij/tree/main/src/main/resources/templates (a dap and lsp folders) which contains dap and lsp servers.

    Please note those JSON files which describes a language server like https://github.com/redhat-developer/lsp4ij/tree/main/src/main/resources/templates/lsp/astro-ls can be generated by exporting a language server that you have already defined https://github.com/redhat-developer/lsp4ij/blob/main/docs/UserDefinedLanguageServer.md#exporting-templates

    What do you think about this idea?

  11. pddshk commented on Mar 24, 2026

    @pddshk

    Im currently investigating possible solutions including

    1. Setting up multiple projects attached to the same session (each one including it's own pyproject.toml)
    2. Using built-in option 'workspaces: sources roots' in pyright plugin

    The goal is to create reproducible editor-agnostic plug-and-play setup for team. I'll write back here once I find a solution

  12. pddshk commented on Mar 27, 2026

    @pddshk

    @angelozerr I'm back and here's what I found:

    Both approaches are viable within pyright plugin, it utilizes workspace folders feature of LSP, however it loads workspaces eagerly. It looks like with proper multiroot setup in pycharm this should also work within LSP4IJ extension, however I didn't test it. Do you know anything about workspace folders support in your plugin and maybe lazy-loading of those whenever possible?

  13. angelozerr commented on Mar 27, 2026

    @angelozerr
    Contributor

    Workspace folder is very basic, it is just the project which is considered as workspace.

    But I am opened to improve that if there are concrete usecases.

  14. pddshk commented on Mar 30, 2026

    @pddshk

    Yeah, but default settings seem to treat only pycharms project roots as workspace folders and tried to attach all of them eagerly.

    I work in a huge monorepo with a ton of python modules and I only need a few of them. This results in LSP not finding the config, and starting to analyze everything wrongly, guzzling RAM, and so on.

    With Neovim I'm able to lazy-load LSP instances (or lazy-attach workspace folder to an already running LSP instance) on opening specific files (it discovers roots by root markers like .git, .hg, .svn, pyproject.toml, compile_commands.json etc. and starts LSP from there or attaches found roots as workspace folders).

    With Pyright plugin and built-in LSP client I can use "Workspace Folders = Sources Roots" setting (which is unfortunately not working within LSP4IJ). For the screenshot above it will look like: both a and src directories are marked as sources root (blue color highlight in pycharm by default) and only those folders are workspace folders for lsp

    So the only way for me of using LSPs in PyCharm is to apply some MuLtIRoOt SoRcErY with pycharm project's set up gui or xml or whatever (which is kinda annoying and I'm not that used to it -- it changes layout of everything drastically). Mutliroot setup for the project above would look like instead of single Untitled23 project there will be two projects named a and src which throws out everything else in Untitled23 folder and just looks weird to me.

    So the proposal is as follows: make the following flow an option

    1. LSP is started empty (no initialize request)
    2. if there are open files, then resolve and collect roots for those files -- whether by root markers by "source root" pycharm's marker or fallback to pycharm's project root -- add collected roots to initialize request
    3. initialize lsp
    4. when a file is open inside of a project -- resolve its root and if such root was not yet attached as a workspace folder -- notify lsp with workspaces/didChangeWorkspaceFolders
    5. For external files (not present in project scope) no LSP actions are made

    This is the flow for IDE start -- we may start LSP that way right after session with open files is restored -- or for LSP restart.

    It would be also nice to have a GUI for turning off workspaces, if possible, but this looks like a separate feature

  15. 44 remaining items

  16. moved this to In Progress in Java Toolingon May 12, 2026
  17. moved this from In Progress to Done in Java Toolingon May 12, 2026
  18. angelozerr commented on May 12, 2026

    @angelozerr
    Contributor

    @pddshk I have merged the PR and once https://github.com/redhat-developer/lsp4ij/actions/runs/25752738303 will be finished please install https://github.com/redhat-developer/lsp4ij#testing-nightly-builds and give me feedback.

    I will write user guide.

    As long as LSP4IJ is not released we can change anything. For instance please give me feedback about the JSON config (lazy, etc)

    @InSyncWithFoo I think you can be interested with this feature, see doc at https://github.com/redhat-developer/lsp4ij/blob/main/docs/DeveloperGuide.md#workspace-folders

  19. added a commit that references this issue on May 12, 2026
    c00ea90
  20. InSyncWithFoo commented on May 13, 2026

    @InSyncWithFoo
    Contributor

    @angelozerr Thanks for the notification. I don't quite have the time or energy to work on plugins recently, but I'm glad to hear LSP4IJ is ever improving.

  21. angelozerr commented on May 13, 2026

    @angelozerr
    Contributor

    @InSyncWithFoo just for your information, LSP4IJ has been integrated by Dart plugin maintained by Google so I need really take care to improve it again

  22. SergejSalnikov commented on May 16, 2026

    @SergejSalnikov

    When will the lsp4ij plugin with that feature will be released?

  23. angelozerr commented on May 16, 2026

    @angelozerr
    Contributor

    @SergejSalnikov have you tried it? If yes please give me feedback.

    I would like to fix and implement few issues. Hope I will finish that next week.

  24. SergejSalnikov commented on May 16, 2026

    @SergejSalnikov

    The feature works for my use case (project files are not located in the same directory as project itself).

  25. pddshk commented on May 17, 2026

    @pddshk

    @angelozerr Checked out nightly build -- it works awesome! The only thing I do not currently understand fully is UI around here

    Image

    Is it just for testing? Or is 'send on init' means 'on init iterate all open files, find roots for them, and send all found workspace folders on init'?

    Thanks for your work! It is amazing!

  26. angelozerr commented on May 17, 2026

    @angelozerr
    Contributor

    @angelozerr Checked out nightly build -- it works awesome!

    Great!

    The only thing I do not currently understand fully is UI around here

    Image Is it just for testing?

    Yes.

    Or is 'send on init' means 'on init iterate all open files, find roots for them, and send all found workspace folders on init'?

    It is just to see which folders will be sent when server will start when server will be started. Please give me some feedback how to improve the UI.

    Thanks for your work! It is amazing!

    You are welcome and if you like LSP4IJ please add a review in JetBrains Marketplace to help us to promote LSP4IJ. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api-customizationenhancement

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions