Skip to content

Fred-Wu/vscode-R-console

Repository files navigation

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.
  • Tab-triggered completion, including objects from the active R session and runtime $ / @ member completion. F7 opens the completion window at the cursor, including empty positions where Tab is used for indentation.
  • Syntax highlighting that follows the active VS Code color theme.
  • Multiline editing with local history navigation, reverse search, and long-input rendering.
  • Auto-matching brackets and quotes.
  • Bracketed paste handling.
demo.mp4
Screen.Recording.2026-05-02.at.4.13.33.pm.mov

Using R Console

Setup

  1. Install vscode-R.

  2. Configure the platform-specific vscode-R R path setting, or make sure R is available from R_HOME or PATH:

    • Windows: r.rpath.windows
    • macOS: r.rpath.mac
    • Linux: r.rpath.linux
  3. Enable bracketed paste mode:

    "r.bracketedPaste": true
  4. To make vscode-R commands target R Console, enable:

    "r.alwaysUseActiveTerminal": true
  5. 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.

  6. Optional: install the R package languageserver for language-server completion.

R Console launches from r.rpath.*, R_HOME, or PATH. It does not launch from r.rterm.windows, r.rterm.mac, or r.rterm.linux.

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.
  • Close a session and stop its R process.
  • Restore a dropped console UI after workspace folder changes or an extension host reload.

Configuration

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 startinglanguageserver
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

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
r.console.pipeOperator |> Pipe operator inserted byR Console: Insert Pipe Operator / Ctrl+Alt+M; supported values are |> and %>%

Dependency Model

  • vscode-R is a hard dependency. R Console uses the same configured R binary.
  • R's languageserver package is optional at runtime but required for language-server completion.
  • The bundled R backend is required at runtime. If the bundled backend for the current target is missing, the console does not fall back to a separate backend.

Warning

Future compatibility change

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 architecture.

A future R Console update will support both vscode-R architectures once the new architecture is officially released.

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, 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

About

A lightweight R console for VS Code

Resources

License

Contributing

Stars

6 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors