Repository navigation
Description
Motivation
vscode-R relies on the bundled sess package for session integration, including workspace inspection, viewers, and editor communication.
Although sess is now a pure R package, it still requires third-party dependencies such as processx, later, jsonlite, and rstudioapi.
These complicate installation, particularly in isolated environments managed by renv, pixi, etc.
PR #1856 improves installation isolation but does not eliminate these dependencies.
Meanwhile, arf already provides an IPC server implemented in Rust, potentially making much of sess's R-based communication infrastructure unnecessary.
Goal
Enable vscode-R session integration through arf without requiring third-party R packages.
This does not necessarily mean eliminating sess itself. Its pure-R runtime functionality could remain available while delegating communication to arf.
Ordinary R consoles and other frontends should continue using the existing sess transport.
Proposed direction
- Separate transport from runtime functionality. Reuse sess's existing workspace, viewer, and runtime integration logic across different transports.
- Use arf's IPC server. Extend its generic capabilities where necessary, particularly for structured R queries and event notifications, without introducing vscode-R-specific APIs.
- Make dependencies optional. Remove
processx,later, andjsonliterequirements from the arf-backed path, and makerstudioapiintegration optional. Existing uses outside the transport layer will also need attention. - Integrate incrementally. Start with ordinary arf terminals and subsequently consider R Interactive, reusing existing abstractions where appropriate.
Scope
This is a long-term architectural direction, not a proposal to replace sess entirely or remove support for other R frontends.
The goal is to reduce installation requirements without duplicating session functionality or compromising compatibility.
Related
- IPC mechanism / lightweight background server in the event loop for external editor support eitsupi/arf#112: Generic IPC server and earlier integration discussions
- fix(sess): separate runtime and transport lifecycles #1739: Runtime and transport lifecycle separation
- sess should be a pure R package #1829: Keeping sess a pure R package
- feat: isolate sess installation in managed libraries #1856: Managed sess installation
Activity
feat: offer rstudioapi from the vscode-R-managed tool library (#1909)
renkun-ken commentedon Nov 28, 2026
I’d start with the Workspace pane in an ordinary arf terminal. arf 0.7.2 already emits
arf.execution_completedfor commands typed at the prompt. The extension can subscribe, fetch an initial snapshot, and refresh it with a fixedcallhandler after each completion. arf emits the event only for user code, so a workspace read won’t trigger a refresh loop. arf’s execution-completion contractI tested this on macOS with a vanilla arf 0.7.2 terminal and
sess,processx,later,jsonlite, andrstudioapiall absent from R’s library path. I exposed the currentget_workspace_data()source through a small test handler. Typingx <- 42Lproduced the terminal completion event. Returning the snapshot directly failed at/searchbecause arf requires a list for a JSON array. Convertingsearchandloaded_namespaceswithas.list()was enough for this example. After detaching, creating a second object, and reattaching, the next snapshot contained both objects. Workspace implementationTwo changes since this was opened narrow the work. #1909 made
rstudioapioptional for ordinary terminals. #1950 added shared inspection handlers, but their publishedvscode-r.inspect.json/*wrappers require the private Interactive runtime and exchange JSON strings throughjsonlite. A separate selector for native values could reuse the workspace logic and preserve the existing wire format for current clients. Inspection contractFor the first extension test, I’d use an empty managed library with package downloads disabled, assign an object in the terminal, and verify that it appears in Workspace both immediately and after Developer: Reload Window. That requires selecting the arf path before the terminal profile prepares the full
sessdependency set. Plain R and arf sessions without the selector can keep the socket path. Viewer payloads and synchronous editor requests can follow separately. Terminal startup