You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to create a language server for each individual project, their directories are independent, but only one can be created through extension points
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
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
@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).
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?
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
LSP is started empty (no initialize request)
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
initialize lsp
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
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
@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.
@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
@angelozerr Checked out nightly build -- it works awesome! The only thing I do not currently understand fully is UI around here
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'?
Activity
angelozerr commentedon Oct 28, 2025
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?
lin-qingying commentedon Oct 28, 2025
lin-qingying commentedon Oct 28, 2025
For example, can you add a servers extension point that returns a List
angelozerr commentedon Oct 28, 2025
Today it is not possible and I think it is not a trivial issue
lin-qingying commentedon Oct 28, 2025
Thank you for your answer, I will change my implementation to meet my requirements
angelozerr commentedon Oct 28, 2025
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
angelozerr commentedon Oct 28, 2025
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
angelozerr commentedon Oct 31, 2025
@lin-qingying can we close this issue?
pddshk commentedon Mar 24, 2026
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
angelozerr commentedon Mar 24, 2026
@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
.lsp4ijfolder that you can set in the project root or ona given folder (according your need).The
.lsp4ijwill 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?
pddshk commentedon Mar 24, 2026
Im currently investigating possible solutions including
The goal is to create reproducible editor-agnostic plug-and-play setup for team. I'll write back here once I find a solution
pddshk commentedon Mar 27, 2026
@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?
angelozerr commentedon Mar 27, 2026
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.
pddshk commentedon Mar 30, 2026
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.jsonetc. 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
aandsrcdirectories are marked as sources root (blue color highlight in pycharm by default) and only those folders are workspace folders for lspSo 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
Untitled23project there will be two projects namedaandsrcwhich throws out everything else inUntitled23folder and just looks weird to me.So the proposal is as follows: make the following flow an option
initializerequest)initializerequestinitializelspworkspaces/didChangeWorkspaceFoldersThis 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
44 remaining items
angelozerr commentedon May 12, 2026
@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
feat: Advanced Workspace folders support
InSyncWithFoo commentedon May 13, 2026
@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.
angelozerr commentedon May 13, 2026
@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
SergejSalnikov commentedon May 16, 2026
When will the lsp4ij plugin with that feature will be released?
angelozerr commentedon May 16, 2026
@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.
angelozerr commentedon May 16, 2026
@SergejSalnikov my bad the documentation is wrong. You need to extend LSPWorkspaceFolderFeature like https://github.com/redhat-developer/lsp4ij/blob/main/src%2Fmain%2Fjava%2Fcom%2Fredhat%2Fdevtools%2Flsp4ij%2Fserver%2Fdefinition%2Flaunching%2FUserDefinedWorkspaceFolderFeature.java
angelozerr commentedon May 16, 2026
@SergejSalnikov doc should be fixed https://github.com/redhat-developer/lsp4ij/blob/main/docs/DeveloperGuide.md#projectworkspacefolderstrategy-default
SergejSalnikov commentedon May 16, 2026
The feature works for my use case (project files are not located in the same directory as project itself).
pddshk commentedon May 17, 2026
@angelozerr Checked out nightly build -- it works awesome! The only thing I do not currently understand fully is UI around here
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!
angelozerr commentedon May 17, 2026
Great!
Yes.
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.
You are welcome and if you like LSP4IJ please add a review in JetBrains Marketplace to help us to promote LSP4IJ. Thanks!