Open renkun-ken opened 1 year ago
As this has now been incorporated in the new release, could you provide an example for how to use this feature when working with, say, 2 projects?
For languageserver
to work with R, does this involve to open a second R terminal, or does it only matter about respecting the settings under each project?
vscode-R just adds a new setting r.lsp.multiServer
to allow user to disable multi-server approach so that a single languageserver handles all requests from r
and rmd
documents.
On languageserver side, the implementation is not yet ready, mainly due to the complexity of handling multiple workspace folders where each uses a separate .Rprofile
setup (e.g. to activate renv, common library(...)
, modify libPaths, etc.), so that languageserver may have to start an R session from each workspace folder so that the behavior of each R session is consistent with the setup for each folder. This requires some important changes to the design of languageserver itself. I'm still working on this.
If we ignore the .Rprofile
related issues, the work needed in languageserver is to
Currently, we only support working with a single workspace in a Language Server session. The support of multi-root workspace (i.e. multiple workspace folders) is implemented on client side. For example, in vscode-R, we spawn a language server for each workspace folder and use documentSelector to make each language server only handle requests from the corresponding workspace folder.
However, the approach is somehow problematic in the following aspects:
Therefore, I'd like to add native support for multi-root workspace in langaugeserver, and on client side, it just needs one client and one server to handle all requests. On server side, it seems that each workspace folder will need a process to start from the workspace folder so that the Rprofile and folder-specific settings could be properly respected.