`.vsc.attach()` not found for self-managed R sessions in tmux
See original GitHub issueDescribe the bug
When working in a Remote SSH environment, .vsc
commands are not found for R sessions created manually within tmux, even after following the instructions found here. They work fine when creating an R terminal using the control palette command.
Details that may be relevant:
- renv version 0.13.2 (.Rprofile has been modified as per these instructions at
~/.Rprofile
as well as within the renv project) - using radian R console
To Reproduce Steps to reproduce the behavior:
- From VS code, connect to SSH host using Remote SSH extension
- Create a new terminal
- Start tmux
- Within tmux, start a radian console
- Within radian, try running
.vsc
commands orView()
,plot()
, etc.
Do you want to fix by self? (We hope your help!)
Yes
(If yes,) what kind of help do you want? (e.g. Which file should I fix, Survey (related documents)
(If related)setting.json
// R path for Linux
"r.rterm.linux": "r4", // alias for 'radian --r-binary=/opt/R/4.0.2/bin/R'
// R command line options (i.e: --vanilla)
"r.rterm.option": ["--r-binary=/opt/R/4.0.2/bin/R"],
// Keeping focus when running
"r.source.focus": "editor",
// Use active terminal for all commands, rather than creating a new R terminal
"r.alwaysUseActiveTerminal": true,
// Use bracketed paste mode
"r.bracketedPaste": true,
// Enable R session watcher
"r.sessionWatcher": true,
// Delay in milliseconds before sending each line to rterm (only applies if r.bracketedPaste is false)
"r.rtermSendDelay": 8,
Expected behavior
- when running
.vsc.attach()
, the R console should be attached to the session watcher - when running
View()
andplot()
commands, the associated viewer/plot object should be displayed in a panel
Screenshots
If applicable, add screenshots to help explain your problem.
You can show the keybord contents by pressing F1
and Developer: toggle screencast mode
Environment (please complete the following information):
- OS: Ubuntu 18.04 (via SSH)
- VSCode Version: 1.57.1
- R Version: 4.0.2
- vscode-R version: 2.0.0
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Writing R in VSCode: Interacting with an R session - Kun Ren
I only need to start a tmux session, open multiple windows, and start as many R sessions as I need in these windows....
Read more >R session not attached after run command create terminal and ...
Restart VSCode; Create terminal command; still shows R: (not attached); Click on the R: (not attached) will run .vsc.attach() but nothing ...
Read more >Reattached tmux session not importing ~/.bashrc
I am using iTerm2 integrated with tmux. My normal working pattern is to first open up the iTerm2 terminal on my Mac, and...
Read more >R Session watcher - REditorSupport/vscode-R GitHub Wiki
R session watcher enables the communication between vscode-R and a live ... folder to current session. .vsc.attach() # A customizable View() ...
Read more >How I navigate tmux in 2021 - Waylon Walker
If you're in a tmux session, it does nothing, and if you're not in one, it will attach you to the first one....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It appears that the
.Rprofile
must contain a trailing new line (see here), which may have been removed by VS code linters. After adding a new line, everything works as intended.It seems that the
init.R
contains the expression now, so we don’t need to set that in our Rprofiles. https://github.com/REditorSupport/vscode-R/blob/8ec924b2a1b18ea722172995fa702c938604ecaf/R/init.R#L9-L17