Repository navigation
fix: activate R features on demand - #1954
Conversation
eitsupi
left a comment
There was a problem hiding this comment.
Review by ChatGPT of a0cc735.
The activation strategy looks sound. Two points remain:
-
[P2] Verify persistent R terminal restoration. The activation tests explicitly disable
terminal.integrated.enablePersistentSessions. After a window reload, VS Code may restore an existing R terminal without triggeringonTerminalProfile. If no R document is open, vscode-R may remain inactive and fail to reconnectsess. Please test this scenario or document delayed reconnection as intentional behavior. -
[P3] Use
closeinstead ofexitfor the spawned VS Code process. Inscripts/test-activation.cjs, theexitevent can occur before stdout/stderr streams have closed. Callinglog.end()afterward may race with remaining output. Waiting forcloseavoids this issue.
No other blocking issues identified. The overall approach and activation regression coverage look appropriate.
Opening an unrelated VS Code window currently activates vscode-R and can start background R language-server and help processes. Remove
onStartupFinishedand the genericonNotebook:interactiveevent so activation follows R workspaces/files, R notebooks, restored R webviews, or contributed R commands, terminal profiles, views, and tasks.Native R Interactive tabs still activate through their persisted R input language, including empty consoles. Background tabs wait until displayed. Update the restoration setting and documentation to explain that saved connections reconnect when R features are used.
Managed R terminals can survive a window reload while vscode-R remains inactive. Document this intentional delay and how to reconnect through an R file or R: Activate R Session. A real reload regression verifies that the terminal/R PID, workspace value, and sess identity are preserved, then that explicit activation establishes a new live connection. The spawned editor wait uses
closebefore ending its log stream so stdout/stderr are drained.Add
pnpm run test:activationand run it in the Linux, macOS, and Windows extension CI jobs. The harness uses fresh profiles without forced activation; persisted-tab checks use ordinary development windows because extension test mode uses in-memory editor storage. Failed activation logs are included in the existing CI artifacts.The launcher removes inherited
ELECTRON_RUN_AS_NODEvariables before spawning VS Code, including case variants and empty values that select Node mode on Windows. Subprocess tests cover that environment handling. Parallel session-setup tests use production's 300-second setup budget and read redirected child logs only on failure, so slow Windows source installation and open log handles do not cause false failures.Closes #1922.
Validation:
9dfb20e, including the full Node and extension suites on Linux, macOS, and Windows..rnbentry points activate; empty native R inputs restore after full application exits, and persistent R terminals retain their process and workspace across a window reload before reconnecting.restores native tabs with execution identities, outputs and draft positions intactintegration test passed with the pinned arf 0.7.2-rc.1 runtime.Local validation limitation: the focused
Run Selection can create a persistent Interactive session and ordinary R exit leaves a restored noticetest fails during cleanup withSession agent is disconnected. It reproduces with the original activation events as well as this change. The full hosted extension suites pass on Linux, macOS, and Windows.