Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,32 @@ All notable changes to R Console will be documented in this file.
### Recent changes

- Added support for vscode-R 3.0's `sess` package, which connects R sessions to VS Code, while retaining the older session watcher for earlier vscode-R versions.
- Aligned session connections with the latest vscode-R public APIs. R Console now obtains connection details directly from vscode-R and uses stable session IDs to select the focused console, replacing clipboard-based connection discovery and manually generated attach messages.
- Each console has its own connection bridge to vscode-R, keeping workspace data and `$`, `@`, and data-frame bracket completions tied to the correct R session.
- Added support for the `jgd` and `httpgd` plot viewers, following vscode-R's resolved plot settings.
- Persistent consoles reuse their connections when detached and reattached. After a window reload, they obtain a new connection and reconnect when focused at an empty main prompt, preserving the busy state of sessions that are still running.
- The older session watcher and the new `sess` integration share common startup and session handling. Local connection sockets on macOS and Linux are accessible only to their owner.
- Plots can open in R's normal graphics windows, such as Quartz on macOS, when vscode-R's Session Watcher is turned off.

### Changes in 0.5.1

#### Added

- Added cross-platform release checks on Linux, Windows, and macOS to improve release reliability.

#### Changed

- Aligned session connections with the latest vscode-R public APIs so the focused R Console is reliably matched to the correct vscode-R session.
- R Console now uses `r.executablePath` for the selected R installation while retaining deprecated `r.rpath.*` settings as a fallback. It no longer writes detected paths to global settings or uses an existing `R_HOME` environment variable to select R.
- R Console now uses `r.consoleArgs` for R startup arguments while retaining deprecated `r.rterm.option` as a fallback.

### Added
#### Fixed

- Added automated checks on Linux, Windows, and macOS for TypeScript, Rust, real R sessions, VS Code activation and commands, and extension packaging. Release packaging now requires these checks to pass.
- Reduced console language-server startup delays, especially for larger projects.
- Function-argument suggestions now remember the package selected in the completion picker. Manually typed calls continue to follow R's package search order.

### Fixed
#### Deprecated

- Reduced console language-server startup delays by giving each console an empty workspace, avoiding a scan of the open project before completion requests can be handled.
- Function-argument suggestions now remember the package selected in the completion picker, while keeping the displayed and executed code unchanged. Manually typed calls follow R's package search order.
- Support for vscode-R versions earlier than 3.0 is deprecated and may be removed in a future R Console version.

## [0.5.0] - 2026-09-04 - vscode-R 3.0 architecture compatibility introduced

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

This document covers local development, build, packaging, and implementation notes for R Console contributors.

Implementation details are documented in [docs/IMPLEMENTATION.md](docs/IMPLEMENTATION.md).
Implementation details are documented in [docs/IMPLEMENTATION.md](docs/IMPLEMENTATION.md), including the current vscode-R integration and R executable resolution.

## Requirements

- VS Code 1.85.0 or later.
- Node.js 24.x for the extension build and packaging scripts.
- A local R installation. R Console first reuses vscode-R's resolved help/background R path when available; otherwise it resolves `r.executablePath`, legacy `r.rpath.*`, `PATH`, then the Windows registry on Windows.
- A local R installation. R Console resolves `r.executablePath`, then deprecated `r.rpath.*`, then `PATH`, with the Windows registry as the final Windows fallback.
- [vscode-R](https://marketplace.visualstudio.com/items?itemName=REditorSupport.r). R Console declares `REditorSupport.r` in `extensionDependencies` and depends on [vscode-R](https://marketplace.visualstudio.com/items?itemName=REditorSupport.r) session bootstrap/configuration.
- The R package `languageserver` for language-server completion during local testing.
- Rust/Cargo if you are building the sidecar binaries from source.
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ R Console also contributes its own settings:

## Dependency Model

- [vscode-R](https://marketplace.visualstudio.com/items?itemName=REditorSupport.r) is a hard dependency. R Console uses the same configured R binary, session bootstrap, session watcher, and supported JSON-RPC session protocol.
> [!NOTE]
> Support for vscode-R versions earlier than 3.0 is deprecated and may be removed in a future R Console version.

- [vscode-R](https://marketplace.visualstudio.com/items?itemName=REditorSupport.r) is a hard dependency. R Console uses the same configured R binary and the supported `sess` JSON-RPC 2.0 protocol for vscode-R 3.x, while retaining deprecated compatibility with the pre-3.0 session watcher.
- R's `languageserver` package is optional at runtime but required for language-server completion.
- The bundled `R_CONSOLE_HOST` sidecar is required at runtime. If the bundled binary for the current target is missing, the console does not fall back to a separate backend.

Expand Down
40 changes: 22 additions & 18 deletions docs/IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ is used as a dependency.

| Project | What is referenced or used | Where it appears here |
| --- | --- | --- |
| [`vscode-R`](https://github.com/REditorSupport/vscode-R) | Used for R executable settings and the JSON-RPC session protocol used for attach metadata, workspace data, and member completion. | `src/Terminal/options.ts`, `src/Runtime/VSCR/`, `resources/r/VSCR/` |
| [`vscode-R`](https://github.com/REditorSupport/vscode-R) | Used for R executable settings, the vscode-R 3.x `sess` JSON-RPC 2.0 protocol, and deprecated pre-3.0 session-watcher compatibility. | `src/Terminal/options.ts`, `src/Runtime/VSCR/`, `resources/r/VSCR/` |
| [`arf`](https://github.com/eitsupi/arf) | Reference for Rust embedded-R host structure, dynamic R loading, platform-specific R initialization, callback wiring, generic event/input-handler pumping, and interrupt state handling. | `sidecar/pty-host/src/host.rs` |
| [Ark](https://github.com/posit-dev/ark) | Reference for native R frontend concepts, `ReadConsole` recovery after interrupts/nested input, nested-input separation, and generic R event/finalizer pumping while waiting for input. | `sidecar/pty-host/src/host.rs` |
| [`rchitect`](https://github.com/randy3k/rchitect) | Reference for embedding R from a non-R host process, R home/shared-library discovery, and callback/FFI boundary patterns. | `sidecar/pty-host/src/host.rs`, `src/Terminal/options.ts` |
Expand Down Expand Up @@ -445,6 +445,10 @@ legacy, or `sess` implementation. Transport-specific state, startup, completion,
activation, reconnect, output filtering, and disposal stay inside the selected
implementation directory.

Support for vscode-R versions earlier than 3.0 is deprecated and may be removed
in a future R Console version. The legacy integration remains isolated so it can
be removed without changing the terminal or runtime architecture.

When legacy support is retired, its removal boundary is:

1. delete `src/Runtime/VSCR/legacy/` and `resources/r/VSCR/legacy.R`
Expand All @@ -457,12 +461,10 @@ legacy-specific edit.

### 3.1 Startup Settings From `vscode-R`

R executable selection first reuses vscode-R's resolved help/background R path
(`helpPanel.rPath`) when it is available. If it is unavailable, R Console
falls back to its own resolver in this order:
R Console resolves the R executable in this order:

1. `r.executablePath`
2. legacy `r.rpath.windows`, `r.rpath.mac`, or `r.rpath.linux`
2. deprecated `r.rpath.windows`, `r.rpath.mac`, or `r.rpath.linux`
3. `R` on `PATH`
4. the Windows R registry entry on Windows

Expand All @@ -488,13 +490,13 @@ The same selected R executable is used for:
When `r.sessionWatcher` is enabled, startup chooses one vscode-R session
integration:

- `sess`: pipe-based architecture exposed by vscode-R's public session API.
`vscodeR/sess/integration.ts` calls `session.getConnectionInfo()` to obtain
- `sess`: vscode-R 3.x architecture exposed by vscode-R's public session API.
`src/Runtime/VSCR/sess/integration.ts` calls `session.getConnectionInfo()` to obtain
the protocol version, IPC endpoint, resolved plot backend, and optional JGD
socket, starts a console-owned `SessProxy`, and contributes the proxy endpoint
as `SESS_ENDPOINT` to the embedded R launch.
- `legacy`: legacy file-based watcher architecture. `R Console` sources vscode-R's
`R/session/init.R` and uses `VSCODE_WATCHER_DIR`.
- `legacy`: deprecated pre-3.0 file-based watcher architecture. `R Console`
sources vscode-R's `R/session/init.R` and uses `VSCODE_WATCHER_DIR`.

In `sess` mode, vscode-R owns the IPC server and package installation/update
policy. The `sess` R package may be bundled with vscode-R or installed as a
Expand All @@ -505,7 +507,7 @@ newline-delimited JSON. R Console does not target the obsolete
WebSocket/port-token `sess` transport.

The `SessProxy` is a transparent IPC proxy. The embedded R session connects to
the console-owned proxy pipe, and the proxy connects to vscode-R's real pipe.
the console-owned proxy endpoint, and the proxy connects to vscode-R's endpoint.
Raw newline-delimited JSON-RPC messages are forwarded in both directions. R
Console observes workspace responses and injects its own `workspace` and
`completion` requests when the console needs session data. It uses only
Expand Down Expand Up @@ -593,11 +595,11 @@ expression. Console data-frame bracket completion uses the same runtime
completion request with the data object expression, because vscode-R 3.0
workspace summaries do not carry column/member names.

For reconnect in `sess` mode, `R Console` writes the current `{ pipe }` to
`~/.vscode-R/sessions/{PID}.json`. The R-side bridge can read that file after
a window reload or terminal detach and reconnect to the replacement vscode-R IPC
server. The console still persists and restores its own Rust backend session;
the discovery file is only the metadata bridge.
For reconnect in `sess` mode, R Console does not create a vscode-R discovery
file. After a VS Code window reload, it obtains the current endpoint again through
vscode-R's public session API and reconnects the restored console when it reaches
an empty main prompt. Detached consoles in the same window reuse their existing
proxy connection.

### 3.4 Metadata Consumers

Expand Down Expand Up @@ -639,9 +641,11 @@ fresh session data are available.

Completion data comes from one shared flow:

- runtime/global-environment symbols come from `SessionWatcher` workspace data
- `$` and `@` member completion uses the session-server completion endpoint
when available
- runtime/global-environment symbols come from the selected session integration's
cached workspace data
- `$` and `@` member completion uses the selected session integration:
`sess` JSON-RPC for vscode-R 3.x or the deprecated legacy session server for
pre-3.0 vscode-R
- data-aware bracket and pipe-placeholder contexts use cached session metadata
and current input for the first suggestion pass
- language-server symbols come from the console-owned `languageserver` process
Expand Down
Loading