R Console

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.
Features
- 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.
- Private local IPC for accessing session credentials and connection metadata stored in runtime memory, with authenticated runtime connections.
- Console completion for live R objects, members and function arguments, with Quick Pick (
F7) or inline terminal suggestions.
- Optional static analysis through R's
languageserver for suggestions inferred from unsubmitted code and supported function-call results without executing those calls.
- Package monitoring that keeps completion up to date as libraries and installed packages change, with detailed logs in the R Console Language Server output channel.
- Syntax highlighting that follows the active VS Code color theme.
- Multiline editing and long-input rendering.
- Workspace-aware command history with optional global sharing and reverse search (
Ctrl+R).
- Searchable command history (
F8) with multiple selection, duplicate grouping, editable recall and deletion.
- Auto-matching brackets and quotes.
- Bracketed paste handling.
https://github.com/user-attachments/assets/a1b7390e-eb33-4b9d-8915-85ae51c3039d
https://github.com/user-attachments/assets/d4877829-07e9-42c2-a66b-652695a5ebf4
Using R Console
Requirements
| Component |
Version |
Required for |
| VS Code |
$\geq$ 1.101.0 |
Running the extension |
| R |
$\geq$ 4.0.0 |
Running the console; use a 64-bit installation matching the bundled runtime's architecture |
| vscode-R |
$\geq$ 3.2.0 |
R configuration and session integration |
R package languageserver |
$\geq$ 0.3.22 |
Language-server completion, including opt-in static analysis; optional for running the console |
The default pipe operator, |>, requires R 4.1.0 or later. With R 4.0.x, configure r.console.pipeOperator as %>% and load a package that provides it, such as magrittr.
For vscode-R 3.0.1 or earlier, use R Console 0.5.2.
R Console 0.6.0 no longer supports vscode-R versions earlier than 3.0.0 or their legacy session watcher.
Setup
Install R and vscode-R according to the requirements.
Configure r.executablePath. The deprecated r.rpath.<platform> setting is still supported for compatibility. If neither setting is set, R Console looks for R on PATH and, 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 vscode-R session integration enabled for workspace metadata, plots, help and data viewers:
"r.sessionWatcher": true
This setting is enabled by default unless explicitly set to false.
Optional: install or update the R package languageserver in the R installation used by the console for language-server completion:
install.packages("languageserver")
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.
R Console Commands
Launch R Console
Launch R Console from the Command Palette:
R Console: Create R Console
R Console: Create R Console in Side Editor
Persistent Session Management
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.
- Restore a dropped console UI after workspace folder changes or an extension host reload.
- Close a session and stop its R process.
- Close incompatible sessions that can no longer reconnect after a connection protocol update.
After a connection protocol update, a one-time notice offers to close older sessions that can no longer reconnect.
Delete All Command History
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.
Configuration
Core vscode-R settings
Configure these settings from vscode-R for R discovery, editor and session integration:
| Setting |
Purpose |
r.executablePath |
Vanilla R executable path; required when R cannot be discovered automatically |
r.bracketedPaste |
Set to true for correct handling of code sent from the vscode-R editor; clipboard paste handling is always enabled |
r.alwaysUseActiveTerminal |
Set to true so vscode-R commands target the active R Console; also focuses newly opened consoles |
r.sessionWatcher |
Enabled by default. Provides session integration through vscode-R's sess, including workspace metadata, plots, help and data viewers |
R Console settings
| Setting |
Default |
Purpose |
r.console.completionUI |
quickPick |
Show suggestions in Quick Pick (quickPick) or directly in the terminal (inline). |
r.console.completion.staticAnalysis |
false |
Enable static analysis through R's languageserver to infer function arguments and members from unsubmitted code and supported function-call results without executing those calls. Applies to both completion modes. |
r.console.inlineCompletion.trigger |
tab |
Show inline suggestions while typing (typing) or when pressing Tab (tab). Applies only when r.console.completionUI is inline; it does not affect Quick Pick. |
r.console.inlineCompletion.minCharacters |
3 |
Start automatic suggestions after this many characters in the current completion prefix. Minimum: 1. Applies only to inline + typing; Tab can request suggestions earlier. |
r.console.inlineCompletion.acceptOnEnter |
true |
Accept inline suggestions with Enter. Disable to submit input with Enter and accept suggestions with Tab. Applies only to inline. |
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 |
Number of spaces per indentation level (a non-negative integer). Set to 0 for zero-width indentation. |
r.console.pipeOperator |
|> |
Pipe operator inserted byR Console: Insert Pipe Operator / Ctrl+Alt+M; supported values are |> and %>% |
Optional vscode-R settings
| Setting |
Purpose |
r.consoleArgs |
Extra arguments passed to R |
r.rpath.<platform> |
Deprecated. Use r.executablePath instead |
r.rterm.option |
Deprecated. Use r.consoleArgs instead |
r.session.emulateRStudioAPI |
Enables RStudio API emulation through sess |
r.rtermSendDelay |
Helps determine buffering time for programmatically sent input |
r.lsp.args |
Extra arguments passed when starting languageserver |
r.lsp.use_stdio |
Uses stdio instead of a loopback socket for the console language server on macOS and Linux; Windows always uses a loopback socket |
r.lsp.lang |
Sets the language-server process locale |
Dependency Model
Minimum versions are listed together under Requirements.
- vscode-R is a hard dependency. R Console uses the same configured R binary and vscode-R's supported
sess session API.
- 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.
- Legacy session-watcher integration for vscode-R versions earlier than 3.0.0 is no longer supported. An incompatible session API leaves the console running without session integration.
Acknowledgements
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.
Development Note
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.
Contributing
See CONTRIBUTING.md for local setup, build, packaging, and manual testing links.
License
MIT