Skip to content

More robust session watcher initialization #196

Description

@renkun-ken

We could make session watcher script initialization more robust with the following applied:

  • init.R detects if environment variable TERM_PROGRAM=vscode. Only in VSCode it is effective.
  • ~/.Rprofile only sources init.R when ~/.vscode-R/init.R exists. Disabling r.sessionWatcher removes ~/.vscode-R/init.R so that user does not have to comment out or remove the source() line manually.

The only drawback of detecting TERM_PROGRAM=vscode is that if R is started in a pre-existing environment inside a terminal multiplexer (e.g. tmux and screen) whose server program is not started inside VSCode terminal, it won't get a TERM_PROGRAM=vscode environment variable. But user could always set this environment variable to force it.

This is related to #190, #195, randy3k/radian#139. When user tries to disable session watcher by setting "r.sessionWatcher": false but leaves source(...) line in ~/.Rprofile or any other startup script, the use of all R sessions will be broken.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions