REditorSupport / REditorSupport/vscode-R

R terminal doesn't execute `~/.Rprofile` if renv is enabled and `RENV_CONFIG_USER_PROFILE=TRUE` is set in `~/.Renviron`

Open
#1,425 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

Describe the bug
R doesn't execute ~/.Rprofile if renv is enabled and RENV_CONFIG_USER_PROFILE=TRUE is set in ~/.Renviron.

Background: renv is not supposed to source ~/.Rprofile by default, but this can be changed via RENV_CONFIG_USER_PROFILE environment variable.

To Reproduce
Steps to reproduce the behavior:

  1. Create an empty project with renv::init()
  2. Set RENV_CONFIG_USER_PROFILE=TRUE in ~/.Renviron.
  3. Add some diagnostics code to ~/.Rprofile. E.g., cat("hello\n").
  4. Open code session in the project directory.
  5. Open an R terminal for that project.

Can you fix this issue by yourself? (We appreciate the help)

No

Expected behavior
hello when a new R terminal is started

However, if you start R from terminal in the same directory you see hello.

  • OS: macOS and linux
  • VSCode Version: 1.82.1
  • R Version: 4.3.0
  • vscode-R version: 2.8.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with ~/.Renviron setting RENV_CONFIG_USER_PROFILE=TRUE, ~/.Rprofile printing hello, an renv::init() project, and an R terminal. Start by tracing the R terminal startup entry point in the TypeScript extension and compare it with launching R directly; done means the terminal prints hello for the project without breaking normal startup.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript, vscode
Domain
cli, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.