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
People typically use this sort of hook to schedule startup-ish code that makes use of, for example, readline(), menu() or rstudioapi. Our immediate use case here in Positron is related to renv, where it would be nice to schedule the "hey you need to do renv::restore(); shall we do it? interaction for execution after R has been fully stood up.
Follow-up work related to posit-dev/positron#2070 and renv support.
RStudio supports a session init hook that runs after R is fully initialized:
https://github.com/rstudio/rstudio/blob/8ebe5431ca2fb3c9719b70d4fbc45201d226c79c/src/cpp/session/modules/SessionRHooks.hpp#L19
https://github.com/rstudio/rstudio/blob/8ebe5431ca2fb3c9719b70d4fbc45201d226c79c/src/cpp/session/SessionMain.cpp#L857
https://github.com/rstudio/rstudio/blob/8ebe5431ca2fb3c9719b70d4fbc45201d226c79c/src/cpp/session/modules/SessionRHooks.hpp#L36-L39
https://github.com/rstudio/rstudio/blob/8ebe5431ca2fb3c9719b70d4fbc45201d226c79c/src/cpp/session/modules/SessionRHooks.R#L16-L31
Good resource on R startup: https://rstats.wtf/r-startup
People typically use this sort of hook to schedule startup-ish code that makes use of, for example,
readline(),menu()or rstudioapi. Our immediate use case here in Positron is related to renv, where it would be nice to schedule the "hey you need to dorenv::restore(); shall we do it? interaction for execution after R has been fully stood up.GitHub search for uses of
rstudio.sessionInit:https://github.com/search?q=rstudio.sessionInit&type=code