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
{{ message }}
Repository navigation
Support dir-nested R packages (monorepo support) #619
Currently this language server have two modes (AFAIK):
If the workspace is an R package, i.e. have a "NAMESPACE" file), then the whole code of the package will be loaded and parsed.
If not, only the opened files in the editor will be parsed.
While this is a good default behavior in my opinion, I suggest to generalize this and give more control for the user, so in the same workspace there could be many (or even only one) R packages in nested directory.
My suggestion is to introduce a new option to the user configuration, say nested.packages.depth.
This option is a number specifying what is the maximal nested directory depth that the language server will scan for R package. Some special cases:
The default value is 0, which mathematically says exactly the current behavior specified above.
For full recursive scanning, the user can specify the value of Inf (don't know how to handle cycled soft/hard links though)
For forcing the language server to ignore any package appears in the workspace, the user can define this value to be a negative number.
While not necessarily looking for monorepo support. I am too looking for support of R packages in a subdirectory.
When I develop an R package it is usually within a subdirectory of compared to the root of the project. Since I want to keep my package root clean an separate from all the other stuff that might come looking in project development (dockerfiles, ci-files, client-documentation, etc...)
Having the ability to point the LSP towards the directory in which my R package lives would be REALLY great!
I've only looked through the code for a bit, so take this with a good helping of salt, but it might be feasible to add such a feature. HOWEVER it might be smarter to just wait for ark to mature to the point where it can be used as a standalone LSP. It already handles my situation with a nested package, but I don't want to use the Positron, where it apparently runs as a Jupyter kernel.
The logic of reading ${workspace}/R/*.R could be changed to simply (?) look for more files by dropping this conditionality:
Activity
argxltuijnder commentedon Oct 4, 2024
While not necessarily looking for monorepo support. I am too looking for support of R packages in a subdirectory.
When I develop an R package it is usually within a subdirectory of compared to the root of the project. Since I want to keep my package root clean an separate from all the other stuff that might come looking in project development (dockerfiles, ci-files, client-documentation, etc...)
Having the ability to point the LSP towards the directory in which my R package lives would be REALLY great!
mmyrte commentedon Feb 4, 2025
I've only looked through the code for a bit, so take this with a good helping of salt, but it might be feasible to add such a feature. HOWEVER it might be smarter to just wait for ark to mature to the point where it can be used as a standalone LSP. It already handles my situation with a nested package, but I don't want to use the Positron, where it apparently runs as a Jupyter kernel.
The logic of reading
${workspace}/R/*.Rcould be changed to simply (?) look for more files by dropping this conditionality:languageserver/R/handlers-general.R
Lines 50 to 58 in 9b30018
And globbing for more
R/*.rorNAMESPACEfiles indicating a package root:languageserver/R/workspace.R
Lines 251 to 264 in 9b30018
Whereas the NAMESPACE logic should make fewer assumptions about the location of the file versus the workspace root:
languageserver/R/workspace.R
Lines 266 to 270 in 9b30018
Add nested_packages_depth to index packages in sub-directories