REditorSupport / REditorSupport/vscode-R

Unable to attach active R terminal: `could not find function ".vsc.attach"`

Open
#1,094 26 comments 6 reactions 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
I updated R to the most recent version (4.2.0). As a consequence, I had to reinstall several packages, including languageserver. After this I am no longer able to attach the active R terminal to the active VS Code session. Instead, when I click the "R" button in the bottom right corner, I get the error Error in .vsc.attach() : could not find function ".vsc.attach" I tried reinstalling the R extension in VS Code as well, without any luck.

To Reproduce
Steps to reproduce the behavior:

  1. Upgrade R to version 4.2'
  2. Install package languageserver
  3. Reinstall R extension (REditorSupport)
  4. Start new R terminal
  5. Click on R button in the bottom left corner
  6. See error

Do you want to fix by self?

If it's just a tweak of settings, I might be able to do it myself.

setting.json (I doubt it's related, but I can't say for sure.)


"r.rterm.linux": "/opt/anaconda3/bin/radian",

// R command line options (i.e: --vanilla)
"r.rterm.option": [--no-save, --no-restore],

// Keeping focus when running
"r.source.focus": "editor",

// Use active terminal for all commands, rather than creating a new R terminal
"r.alwaysUseActiveTerminal": false,

// Use bracketed paste mode
"r.bracketedPaste": false,

// 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
Start R kernel and and attaching to current session. R Help, plots, etc. opens in tab.

Screenshots
image

Environment (please complete the following information):

  • OS: Ubuntu 20.04.4 LTS
  • VSCode Version: 1.66.2
  • R Version: 4.2.0
  • vscode-R version: 2.4.0

Additional context
In addition to reinstalling languageserver, a wide number of packages had to be updated/reinstalled. In addition, when starting a new R terminal in R, it started and Anaconda's (much) older R version. I had to copy the R executable from /bin/R to opt/anaconda3/envs/renv/bin/R to load the newly updated R version.

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

Start by reproducing the failure with R 4.2.0, the listed VS Code and vscode-R versions, and an active R terminal, then trace the extension's active-terminal attach entry point that invokes .vsc.attach(). Done means clicking the R button attaches the current session without the missing-function error and restores R help and plot handling.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.