A lightweight R console extension for VS Code with multiline editing and syntax highlighting. Designed to work seamlessly with the vscode-R extension.
- cross platform, runs on Windows, macOS and Linux
- native VS Code pseudoterminal integration
- multiline editing with expression-aware input
- syntax highlighting for R code
- auto matching brackets and quotes
- persistent command history with incremental search (Ctrl+R)
- vscode-R integration: session watcher, shared settings, "Run Selection" support
- auto completion via QuickPick UI, session watcher and vscode-R language server
- experimental reticulate python mode: use
reticulate::repl_python()to enter Python REPL
git clone https://github.com/Fred-Wu/vscode-R-console.git
cd vscode-R-console
npm install
npm run compile- VS Code 1.85.0 or later
- R installation (detected configurations via vscode-R settings)
- vscode-R extension (required dependency)
- Open Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run "R: Create R Console" (opens in terminal panel)
- Or "R: Create R Console in Side Editor" (opens beside your code)
- Start typing R code!
# Enter Python mode
R> library(reticulate)
R> use_condaenv("C:/Users/xxxx/AppData/Local/miniforge3/envs/pyproj/python.exe")
R> repl_python()
Python 3.13.11 (C:/Users/xxxx/AppData/Local/miniforge3/envs/pyproj/python.exe)
Reticulate 1.44.1 REPL -- A Python interpreter in R.
Enter 'exit' or 'quit' to exit the REPL and return to R.
>>> a = 1
>>> b = 2
>>> exit
R> py$a
[1] 1
R> py$b
[1] 2R Console respects vscode-R settings:
| Setting | Description |
|---|---|
r.rterm.windows |
Path to R executable (Windows) |
r.rterm.mac |
Path to R executable (macOS) |
r.rterm.linux |
Path to R executable (Linux) |
r.rterm.option |
Command line arguments for R |
r.sessionWatcher |
Enable session watcher integration |
r.bracketedPaste |
Enable bracketed paste mode |
R Console specific settings:
| Setting | Default | Description |
|---|---|---|
r.console.autoMatch |
true |
Auto-insert matching brackets/quotes |
r.console.tabSize |
2 |
Indentation size |
- Keyboard interruption is emulated over child-process pipes (pseudoterminal integration), not delivered through a native PTY/TTY signal path. This means key behavior can differ from a real terminal in edge cases.
Ctrl+Chandling is state-gated. It is treated as a runtime interrupt only when the console is in a traced waiting-for-input state. Outside that state, behavior is local/UI-level and may not match native REPL signal semantics.Ctrl+Zsuspend/EOF semantics are not implemented as true terminal job control. On this transport,Ctrl+Zis not guaranteed to behave like native Windows/Unix consoles.- Protocol markers (for example input begin/end markers) are control metadata for the extension. They are not OS signals and cannot guarantee interruption of all blocking reads.
- Experimental Python mode relies on a busy-only heartbeat (via
sys.settrace). Long-running Python code that produces no output can be hard to distinguish from waiting-for-input, so input gating may be conservative. - R/Python busy state cannot be reliably distinguished between “waiting for computation to finish” vs “waiting for user input,” so the console may misclassify some waits.
- In reticulate mode, some environments may crash with OpenMP duplicate-runtime errors (for example:
OMP: Error #15 ... libiomp5* ... libomp*). This usually happens when R and Python load different OpenMP runtimes in the same process (common with mixed MKL/LLVM/GNU stacks). On Windows, this extension now setsKMP_DUPLICATE_LIB_OK=TRUEby default to avoid immediate abort, but that is a workaround and does not remove the underlying runtime conflict. - Python progress bars can render in different colors depending on the stream they use: stderr is shown in red, stdout in default color. Mixed-stream progress output may appear to alternate colors.
MIT
This extension's source code was written with assistance from GitHub Copilot (GPT-5.2 and Claude Opus 4.5). The overall feature design and logic decisions are mine; Copilot was used to generate and iterate on the implementation.
- Built with VS Code Extension API
- vscode-R - The R extension for VS Code that this console integrates with. Session watcher code adapted from vscode-R.
- radian by Randy Lai - A 21st century R console that inspired the design of this extension. The multiline editing, syntax highlighting, and reticulate integration concepts are influenced by radian.