Louis/Thèse/Résolution des problèmes/vscode-R qui s'attache mal.md
Louis Lacoste cbe404670f
vault backup: 2026-06-12 11:43:53
Affected files:
.obsidian/workspace.json
Thèse/Axes/Phylogénie/Modèle mixte avec arbre phylogénétique.md
Thèse/Packages/R/colSBM.md
Thèse/Résolution des problèmes/vscode-R qui s'attache mal.md
2026-06-12 11:43:54 +02:00

1.4 KiB

La solution vient de Github de vscode-R cette issue

Had the same issue after updating R from 4.5.2 to 4.6.0. .vsc.attach() could not be found anymore.

The root cause is that R 4.6.0 no longer calls .First.sys() during startup. The extension's init.R relies on overwriting .First.sys to initialize the session watcher, so the attach function never gets defined.

Fix that worked for me (in init.R of the extension, for me located at ~/.windsurf/extensions/reditorsupport.r-2.8.8-universal/R/session/init.R):

  1. Change the assign call from .First.sys to .First:
- assign(".First.sys", init_last, envir = globalenv())
+ assign(".First", init_last, envir = globalenv())
  1. Remove the old.First.sys lines:
- old.First.sys <- .First.sys

and inside init_last:

- old.First.sys()
  1. Update the cleanup at the end of init_last:
- rm(".First.sys", envir = globalenv())
+ rm(".First", envir = globalenv())

After restarting the R terminal everything attaches correctly again. This should probably be patched in the extension since R 4.6.0 deprecated .First.sysentirely.