-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for {renv} projects #93
Comments
That is interesting, I just opened like 5-6 old projects using |
Interesting indeed! Have you previously done any additional setup to get renv working with R.nvim? |
Nothing I can think of. I just had a look inside one of the |
That's very strange - if renv installs nvimcom, it must have already cached it or be configured to know where to look for it, since nvimcom isn't on CRAN. Either way, I'm 99% sure it won't Just Work™ from a fresh system. Would be great if others could test and confirm 🙏 |
I've had this problem before and just tested it now. I bypass renv by setting The reason for this is that with If I open a renv project without |
I can confirm that R.nvim works fine with {renv} with no issue. The only step needed is to completely exit Neovim after |
Can we close this? I am using |
@PMassicotte I believe I am facing the same issue. |
What is the value of setwd = "nvim", |
|
Do you use built-in terminal or something else? |
Yes, I use the built in terminal for R in R.nvim. |
That is interesting. I can not reproduce the problem at the moment. When I open a |
Hey, this helps! If I wait for a few seconds and then start R, I get no issues. Only if I start R immediately after opening a .R file in a
However, unlike you I do not get a prompt saying that |
The |
I am using auto-open in my config, so it is likely waiting for the initialization to be done before loading R. My guess is that you just have to wait 2-3 seconds before opening the terminal in an |
I see. Thanks for the clarification @jalvesaq and @PMassicotte! |
Is this still relevant? I am using |
NB, this issue has previously been discussed at jalvesaq/Nvim-R/issues/445.
Problem description
When a project uses {renv}, {nvimcom} is not available, meaning a good deal of R.nvim breaks. The reason for this is that in {renv} projects the
.libPaths()
are reset, meaning R can no longer find {nvimcom}, which will have been installed by R.nvim into the libpath where most other package installations also live.Current workaround
The workaround people seem to have been using is to:
nvimcomlib
nvimcom
installationRENV_CONFIG_EXTERNAL_LIBRARIES
environmental variable to point to this new libpath, which tells {renv} it can also look for package installations hereThere are a few issues with this workaround:
Suggested approach for seamless {renv} support
R_LIBS
environmental variable before R starts upRENV_CONFIG_EXTERNAL_LIBRARIES
environmental variable to the same value, thereby making {nvimcom} available in {renv} projectsI'm not that familiar with with what happens when R.nvim is installed, so I don't know how realistic/well informed this approach is. However, {renv} is pretty widely used - a quick GitHub search reveals 9.1k repos with a
renv.lock
file - so in my humble opinion, it's worth seriously considering adding official support.The text was updated successfully, but these errors were encountered: