Skip to content
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

Merged
merged 11 commits into from
Jan 24, 2020

Conversation

renkun-ken
Copy link
Member

@renkun-ken renkun-ken commented Jan 10, 2020

Closes #196.
Related to #177, #179.

In this PR:

Copy link
Collaborator

@andycraig andycraig left a 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!

@randy3k
Copy link
Member

randy3k commented Jan 19, 2020

Alternatively, one could make use of the env variable R_PROFILE_USER that points to a vscode generated .Rprofile. For example, vscode-R could generate ~/.vscode-R/.Rprofile and set R_PROFILE_USER to it in the integrated terminal.

# ~/.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 .Rprofile.

@renkun-ken
Copy link
Member Author

renkun-ken commented Jan 21, 2020

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 R: Create R Terminal command.

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 renkun-ken changed the title Update session watcher section in README.md Improve session watcher initialization Jan 21, 2020
@andycraig
Copy link
Collaborator

@renkun-ken This PR is now conflicted with master. Would you be able to resolve that and then I'll merge it? Thanks!

@renkun-ken
Copy link
Member Author

@andycraig Conflicts resolved. Thanks!

@andycraig andycraig merged commit 625ae35 into REditorSupport:master Jan 24, 2020
@andycraig
Copy link
Collaborator

@renkun-ken Great, thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More robust session watcher initialization
3 participants