Closed ArkadiuszMichalski closed 1 month ago
Yes, only one instance of a language server is started.
The start of a server process triggers the initialization request. As long as this server is not restarted, no further initialization request is sent. As already mentioned, the client informs the server about the known root folders as part of the initialization request.
Depending on what the server supports, this means that it either responds to a single root folder or to several workspace folders. If the server supports multiple workspace folders, each time a buffer is activated, the client checks to see if the current FAW root folders have changed and informs the server of the changes if they have.
The client does NOT know how a server handles such information. Whether it treats the different root folders as different projects or as a single project depends on the server. As far as I know, there is currently no specification in the protocol that would allow a client and a server to define how to use such workspace folders.
However, there is a request that is not yet supported by the client that allows the server to ask the client how a workspace is configured or needs to be set up, at least that is my understanding.
From the perspective of NppLspClient, I would say that you can run different language servers in one session at the same time, but only have one project per server in mind. If you want to work on several projects per server in parallel, you should use different Npp instances.
The client does NOT know how a server handles such information. Whether it treats the different root folders as different projects or as a single project depends on the server. As far as I know, there is currently no specification in the protocol that would allow a client and a server to define how to use such workspace folders.
This means that we have to check it individually in each server, which is a bit tedious. But LSP coverage in each server is at a different level, so it's less surprising. We just need to test a lot.
If you want to work on several projects per server in parallel, you should use different Npp instances.
I eventually thought about that too, but I would rather avoid it. Fortunately, this LSP for JS works in such an interesting way that it treats such folders as different projects (I just have to use configuration files pointing to the files of a given project in each such folders).
I just have to use configuration files pointing to the files of a given project in each such folders
But wouldn't that mean that you have to remember to maintain this file as well? The more I think about it, the more I don't like it. Don't get me wrong, I can implement it, but it doesn't seem to benefit my workflow.
Think about how you work on a project - how do you do it?
I, personally, open a cmd with all the environment variables I need and start Npp from the root of such a project - done. Instead of FAW, we could also determine the current directory and then use it. But that would mean that we are now restricted to this language server
.
Now suppose you were asked to review/fix a file of another project that uses the same server. If you want to use the same npp instance, there is no guarantee that the currently running server can provide the features you assume are available due to a different language-specific project configuration file. Even if it works today, the operators of such servers might think differently in the future. The only options I see would be to either stop the current server and restart it with the other project root or implement a client function to start another instance of that server.
However, this in turn means that workspace folders can no longer be determined. For example, if there is a file X that cannot be determined from the root directory of either project A or project B, which server should it be assigned to?
I don't like the current situation 100% either, but I don't yet see how this could really be improved.
Mentions: https://github.com/Ekopalypse/NppLspClient/issues/15#issuecomment-2280065271 https://github.com/Ekopalypse/NppLspClient/issues/15#issuecomment-2282652913
@Ekopalypse At first I have a few basic questions:
dirB jsconfig.json fileB1.js fileB2.js