Skip to content

Session Watcher never attaches on Windows 11 with R 4.6.1 + Radian 0.6.16 (.vsc.attach not found, "R: (not attached)") #1723

Description

@davellb

Description

The R terminal starts correctly inside VS Code and all basic functionality appears to work (code execution, languageserver, httpgd, plotting, etc.), but the Session Watcher never attaches.

The status bar always shows:

R: (not attached)

Clicking it attempts to execute:

.vsc.attach()

which fails with

Error in .vsc.attach() :
  could not find function ".vsc.attach"

As a consequence, the Global Environment pane never updates.


Environment

OS:
Windows 11 x64

VS Code:
1.128.0

Extension:
REditorSupport.r 2.8.8

R:
4.6.1 ("Happy Hop")

Console:
Radian 0.6.16

languageserver:
0.3.18

httpgd:
2.1.4


R terminal configuration

settings.json

{
    "r.rterm.windows": "C:\\Users\\davellb\\AppData\\Local\\Python\\pythoncore-3.14-64\\Scripts\\radian.exe",
    "r.rterm.option": [
        "--no-save",
        "--no-restore"
    ],
    "r.bracketedPaste": true,
    "r.sessionWatcher": true,
    "r.alwaysUseActiveTerminal": true
}

What works

R terminal starts normally
Radian starts correctly
Code execution works
Plotting works
languageserver works
httpgd works
Objects exist in the R session

Example:

example <- 123
ls()

[1] "example"

What does not work

The session never becomes attached.
The status bar always remains
R: (not attached)
The Global Environment pane stays empty.

Clicking the status bar executes

.vsc.attach()

which returns

Error in .vsc.attach() :
    could not find function ".vsc.attach"
Diagnostics

The VS Code environment variables are present.

Sys.getenv("TERM_PROGRAM")

returns

vscode
interactive()

returns

TRUE
Sys.getenv("VSCODE_INIT_R")

points to

C:\\Users\\davellb\\.vscode\\extensions\\reditorsupport.r-2.8.8\\R\\session\\init.R

The startup hook appears to be installed correctly.

identical(.First.sys, base::.First.sys)

returns

FALSE

Printing .First.sys shows the VS Code replacement function, including

exports$.vsc.attach()

However,

search()

never contains

tools:vscode

and

exists(".vsc.attach")

returns

FALSE
Additional information

I also created

C:\Users\<user>\.Rprofile

containing

if (interactive() && Sys.getenv("RSTUDIO") == "") {
    source(file.path(
        Sys.getenv("USERPROFILE"),
        ".vscode-R",
        "init.R"
    ))
}

The file is sourced successfully, but the behavior does not change.

It appears that .First.sys is successfully replaced, but the Session Watcher never completes initialization and .vsc.attach is never exported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions