-
Notifications
You must be signed in to change notification settings - Fork 130
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
Improve session watcher initialization #184
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for switching it to USERPROFILE
!
Alternatively, one could make use of the env variable # ~/.vscode-R/.Rprofile
if (file.exists(".Rprofile")) {
source(".Rprofile")
} else if (file.exists(normalizePath("~/.Rprofile"))) {
source("~/.Rprofile")
}
if (<init.R has not been execuated>) {
source(file.path(Sys.getenv(if (.Platform$OS.type == "windows") "USERPROFILE" else "HOME"), ".vscode-R", "init.R"))
} This approach would require zero configuration for R sessions launched by vscode-R. Only if a user wants to use session watcher in external R processes, they would have to edit the |
ccb580e
to
8963e39
Compare
Thanks @randy3k for your great suggestion. With this PR, user won't have to do any manual configuration if user only starts R session via Now, only users who want to use R session watcher with self-managed R session will have to do some extra configuration. Let me update the README to reflect all these changes. |
@renkun-ken This PR is now conflicted with |
123df40
to
75a5edd
Compare
@andycraig Conflicts resolved. Thanks! |
@renkun-ken Great, thanks again! |
Closes #196.
Related to #177, #179.
In this PR:
USERPROFILE
for Windows according to os: add homedir() nodejs/node#1791: https://github.com/nodejs/node/pull/1791/files#diff-d9bb084c9b6137788ddd0314b2e4df6dR11..Rprofile
exists.R_PROFILE_USER
as @randy3k suggests so that there's no need for manual configuration if users starts R session usingR: Create R Terminal
command.init.R
checksTERM_PROGRAM=vscode
so that it is only effective in VSCode terminal.README.md
to cover basic usage, advanced usage and how to disable session watcher.