rstudio / renv

renv: Project environments for R.
https://rstudio.github.io/renv/
MIT License
1.02k stars 155 forks source link

Default snapshotting behaviour breaks RStudio's `devtools::load_all()` keyboard shortcut #1742

Closed nteetor closed 10 months ago

nteetor commented 12 months ago

Within a package development environment, {renv} does not typically snapshot a package like {devtools}. Unfortunately, this seems to break RStudio's devtools::load_all() keyboard shortcut (i.e. nothing happens). I was able to fix the problem with the following steps,

  1. Configure renv to capture all packages in the project library, renv::settings$snapshot.type("all")
  2. Snapshot packages, renv::snapshot()
  3. Restart R session

A month or so ago I opened a related issue under the rstudio/rstudio repo, https://github.com/rstudio/rstudio/issues/13727.

kevinushey commented 12 months ago

As a workaround, you can add a line like library(devtools) to a file called _dependencies.R in the project. (You may need to include it in .Rbuildignore to make sure it doesn't get built with the package.)

nteetor commented 11 months ago

True, thank you for pointing that out. I'd resigned myself to always using renv::settings$snapshot.type("all").

kevinushey commented 10 months ago

I think the workaround above is sufficient for this particular issue, so I'm going to close -- please let me know if you're still having trouble.