question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`.vsc.attach()` not found for self-managed R sessions in tmux

See original GitHub issue

Describe 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:

  1. From VS code, connect to SSH host using Remote SSH extension
  2. Create a new terminal
  3. Start tmux
  4. Within tmux, start a radian console
  5. Within radian, try running .vsc commands or View(), 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() and plot() 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:closed
  • Created 2 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
dwhdaicommented, Jul 26, 2021

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.

1reaction
eitsupicommented, Jul 26, 2021

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found