R Console is a lightweight R console for VS Code that runs R inside a custom pseudoterminal. It combines a console frontend, a bundled R backend, and language-server completion integration. It is designed to work with VS Code, the vscode-R extension, and R's languageserver package.
Important
The bundled backend executable, R_CONSOLE_HOST, is not currently code-signed. Depending on your OS and security settings, it may trigger a security warning or be blocked when first launched. Install R Console only from the official VS Code Marketplace or this repository's GitHub Releases.
- Custom R console hosted in the VS Code terminal area.
- Persistent R console sessions that can be attached, detached, or closed from VS Code, while preserving custom console names.
- Tab-triggered completion, including objects from the active R session and runtime
$/@member completion.F7opens the R console completions picker at the cursor, including empty positions where Tab is used for indentation. - Syntax highlighting that follows the active VS Code color theme.
- Multiline editing and long-input rendering.
- Reverse search on entered text using
Ctrl+R; repeated presses find older matches.F8opens Command History, a searchable picker with on-demand loading, native multi-selection checkboxes, Select All, and a toggle to collapse or expand exact duplicate entries. Selected entries can be restored as a single editable input without execution, or deleted using the picker toolbar. - Workspace-aware history:
- History scope:
r.console.historyScopedefaults to"workspace", sharing history between consoles in the same workspace folder. Set it to"global"for one shared history; consoles without a workspace automatically use global history. - On-demand loading: The history picker loads matching commands in pages, while console Up/Down navigation fetches older history from the on-disk file as needed.
- History deletion: Delete individual or multiple entries using the history picker. When duplicates are collapsed, deleting a selected entry removes all its matching occurrences.
- History retention: The latest 20,000 commands are retained per scope.
- Existing history: The old
~/.r_console_historyfile is left unchanged and is no longer used. Its commands are not imported into the new history.
- History scope:
- Auto-matching brackets and quotes.
- Bracketed paste handling.
demo.mp4
Screen.Recording.2026-05-02.at.4.13.33.pm.mov
-
Install a compatible version of vscode-R (see Dependency Model).
-
Configure
r.executablePath. The deprecatedr.rpath.<platform>setting is still supported for compatibility. If neither setting is set, R Console looks for R onPATHand, on Windows, falls back to the R installation recorded in the Windows registry. -
Enable bracketed paste mode:
"r.bracketedPaste": true
-
To make vscode-R commands target R Console, enable:
"r.alwaysUseActiveTerminal": true
-
Optional: keep the vscode-R session watcher enabled for active-session object completion and runtime
$/@member completion:"r.sessionWatcher": true
This setting is enabled by default unless explicitly set to
false. -
Optional: install the R package
languageserverfor language-server completion.
R Console resolves r.executablePath, then deprecated r.rpath.*, then PATH, with the Windows registry as the final Windows fallback. Ambient R_HOME is not used to select the executable; it is derived from the selected R executable instead.
Launch R Console from the Command Palette:
R Console: Create R ConsoleR Console: Create R Console in Side Editor
Use R Console: Manage Persistent Sessions... to manage running R Console sessions.
- Attach to a detached R Console session.
- Detach a console UI or close VS Code while leaving the R process running.
- Detach and reattach a console to pick up startup-related setting changes.
- Close a session and stop its R process.
- Restore a dropped console UI after workspace folder changes or an extension host reload.
Use R Console: Delete All Command History from the Command Palette to delete all saved command history in the active R Console's history scope, including the on-disk history file.
The command requires confirmation and affects all consoles sharing that history scope. To delete individual or multiple history entries instead, open the history picker using F8 and use the selection checkboxes and toolbar trash button.
R Console reads several settings from vscode-R:
| Setting | Purpose |
|---|---|
r.executablePath |
Vanilla R executable path |
r.consoleArgs |
Extra arguments passed to R |
r.rpath.<platform> |
Deprecated. Use r.executablePath instead |
r.rterm.option |
Deprecated. Use r.consoleArgs instead |
r.sessionWatcher |
Enables the vscode-R session watcher or console-scoped JSON-RPC 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 |
The executable fallback order is r.executablePath, deprecated r.rpath.*, PATH, then the Windows registry on Windows. For console arguments, r.consoleArgs takes precedence over deprecated r.rterm.option.
R Console also contributes its own settings:
| Setting | Default | Purpose |
|---|---|---|
r.console.historyScope |
workspace |
Share history by workspace folder or use global. Applies when a console is created or reattached. |
r.console.autoMatch |
true |
Auto-insert matching brackets and quotes |
r.console.tabSize |
2 |
Indentation width |
r.console.pipeOperator |
|> |
Pipe operator inserted byR Console: Insert Pipe Operator / Ctrl+Alt+M; supported values are |> and %>% |
Updated vscode-R compatibility requirements: R Console v0.5.3 requires vscode-R v3.2.0 or later. For vscode-R v3.0.1 or earlier, use R Console v0.5.2.
| R Console version | vscode-R version |
|---|---|
| v0.5.3 and later | v3.2.0 and later |
| v0.5.2 | v3.0.1 and earlier |
- vscode-R is a hard dependency. R Console uses the same configured R binary and the supported
sessJSON-RPC 2.0 protocol for vscode-R 3.x, while retaining deprecated compatibility with the pre-3.0 session watcher. - R's
languageserverpackage is optional at runtime but required for language-server completion. - 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:
- vscode-R - R Console depends on vscode-R for configuration, session bootstrap, session watching, the supported JSON-RPC session protocol, 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 - Language-server completion is 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.
See CONTRIBUTING.md for local setup, build, packaging, and manual testing links.
MIT