R Console is a VS Code extension that runs R inside a custom pseudoterminal. It combines a TypeScript console frontend, a bundled Rust sidecar that embeds R directly, and a console-scoped language server client. It is designed to work with VS Code, the vscode-R extension, and R's languageserver.
Implementation details are documented in docs/IMPLEMENTATION.md.
- Custom R console hosted in the VS Code terminal area.
- Embedded console backend for macOS, Linux, and Windows
- Session watcher integration with vscode-R for search-path data, global-environment data, and runtime
$/@member completion. - Self-managed R console sessions that can be attached, detached, or closed from VS Code.
- Console-scoped completion and signature help through R's
languageserverpackage. - Immediate local syntax highlighting plus semantic-token styling also through
languageserver. - Multiline editing with local history navigation, reverse search, and a windowed/collapsed viewport renderer for long inputs.
- Auto-matching brackets and quotes.
- Bracketed paste handling.
- Parser-backed completeness checks before submission.
demo.mp4
Screen.Recording.2026-05-02.at.4.13.33.pm.mov
- VS Code 1.85.0 or later.
- Node.js 24.x for the extension build and packaging scripts.
- A local R installation.
R Consoleresolves it in this order: vscode-Rr.rpath.*, ambientR_HOME, thenPATH. - vscode-R. This extension declares
REditorSupport.rinextensionDependenciesand depends on vscode-R session bootstrap/configuration; there is no standalone startup path.
Important
Only official vscode-R 2.8.x releases are currently supported. Newer vscode-R builds are moving to a WebSocket and JSON-RPC 2.0 based architecture. A future R Console update will support both vscode-R architectures once the new architecture is officially released.
- The R package
languageserverif you want completion, signature help, and semantic highlighting. - Rust/Cargo only if you are building the sidecar binaries from source.
Launch R Console from the Command Palette with:
R Console: Create R ConsoleR Console: Create R Console in Side EditorR Console: Manage Persistent Sessions...
Use the session manager to attach to, detach from, or close running R Console sessions.
The minimum vscode-R setup for R Console commands to work is:
-
Install vscode-R.
-
Prefer setting the platform-specific vscode-R
r.rpath.*entry to the R binary path used byR Console:- Windows:
r.rpath.windows-> path toR.exe - macOS:
r.rpath.mac-> path toR - Linux:
r.rpath.linux-> path toR
r.rterm.*is not required to createR Console. Ifr.rpath.*is unset,R Consolefalls back to ambientR_HOME, thenPATH. After selecting an executable,R ConsolederivesR_HOMEfrom that executable path and loads the matching shared library from that same installation. - Windows:
-
Set
r.alwaysUseActiveTerminalto betrueto make vscode-R commands to targetR Console -
Keep
r.rterm.optioncompatible with embedded startup.R Consolestrips some wrapper-only flags, but startup still requires the vscode-R bootstrap path and will reject options such as--vanillaand--no-init-file.
Useful optional settings:
r.sessionWatcher = truekeeps the vscode-R watcher bridge enabled for workspace/global-environment updates and member completion.r.bracketedPaste = trueenables bracketed paste mode in the console.
npm install
npm run compile
npm run build:sidecar
npm run stage:sidecarcompile type-checks the extension and bundles the extension host entrypoint into dist/extension.js.
stage:sidecar copies the current platform's R_CONSOLE_HOST into bundled/bin/.
dist/, bundled/, and sidecar/pty-host/target/ are generated build outputs and are intentionally not committed.
npm run packageThis produces a target-specific VSIX for the current host platform, for example vsc-r-console-0.2.3-win32-x64.vsix.
vscode:prepublish still prepares the production bundle and stages the current platform binary into bundled/bin/.
Each target-specific VSIX contains exactly one platform-matching R_CONSOLE_HOST binary in bundled/bin/.
R Console reads several settings from vscode-R:
| Setting | Purpose |
|---|---|
r.rpath.windows |
R executable path on Windows for R Console startup |
r.rpath.mac |
R executable path on macOS for R Console startup |
r.rpath.linux |
R executable path on Linux for R Console startup |
r.rterm.option |
Extra arguments passed to R |
r.sessionWatcher |
Enables the vscode-R session watcher bridge |
r.bracketedPaste |
Enables bracketed paste mode |
r.lsp.args |
Extra arguments passed when starting languageserver |
r.lsp.use_stdio |
Uses stdio instead of a loopback socket for the console LSP client when supported |
r.alwaysUseActiveTerminal |
Controls whether the new console is immediately focused |
R Console does not launch from r.rterm.windows, r.rterm.mac, or r.rterm.linux.
If r.rpath.* is set, an ambient R_HOME does not override it. If r.rpath.* is unset, ambient R_HOME is used before PATH.
R Console also contributes its own settings:
| Setting | Default | Purpose |
|---|---|---|
r.console.autoMatch |
true |
Auto-insert matching brackets and quotes |
r.console.tabSize |
2 |
Indentation width |
vscode-Ris a hard dependency. R Console uses the same configured R binary.- R's
languageserverpackage is optional but required for console semantic tokens, completion, and signature help. - The bundled
R_CONSOLE_HOSTsidecar is required at runtime. If the bundled binary for the current target is missing, the console does not fall back to a separate backend.
R Console is built on the broader VS Code, Rust, and R ecosystems, and on the work of open-source projects that informed the extension. In particular, we would like to highlight the following projects:
- vscode-R - R Console depends on vscode-R for configuration, session bootstrap, session watching, and the surrounding VS Code R workflow.
- arf - The embedded-R host design was heavily informed by arf's Rust-based approach to loading and embedding R, platform-specific console initialization, callback wiring, event/input-handler pumping, and backend architecture.
- Ark - The native R frontend model, nested-input handling, ReadConsole recovery concepts, and generic R event-loop integration were important references for the backend design.
- rchitect - Rchitect was a reference for embedding R from a non-R host process, including R home/shared-library discovery and callback/FFI boundary concepts.
- radian - The terminal-first interaction model and several console UX ideas, including multiline editing, history search/navigation, bracketed paste, and prompt-centric workflows, were inspired by radian.
- languageserver - Console completion, signature help, and semantic-token support are built around R's language server.
This extension's source code was written with assistance from GPT models using OpenAI's Codex. The overall feature design and logic decisions are mine; GPT models were used to generate and iterate on the implementation.
MIT