This VS Code extension provides support for the R programming language, including features such as R language service based on code analysis, interacting with R terminals, viewing data, plots, workspace variables, help pages, managing packages, and working with R Markdown documents. See the wiki for full documentation.
The R and R Markdown syntaxes are located in a sibling package vscode-R-syntax.
v3.0.0 of the R Extension for VS Code is a major release. It introduces a
significant architectural change via the sess R
package, which powers faster and more robust communication with the underlying R
session. sess is bundled with the extension and installed automatically if it
is missing or outdated, so no manual setup is needed.
-
Install R (>= 3.4.0) on your system. On Windows, we recommend letting the installer write the R path to the registry.
-
Install the
languageserverpackage from R.install.packages("languageserver") -
Install the stable release of this extension from the VS Code Marketplace or the Open VSX Registry.
code --install-extension REditorSupport.r
Alternatively, you can test the latest development version by installing from GitHub:
Install the development version
The
latestpre-release is rebuilt from every push tomaster. Download and install it:curl -fsSL -o vscode-R.vsix \ https://github.com/REditorSupport/vscode-R/releases/download/latest/vscode-R.vsix code --install-extension vscode-R.vsix
-
Create an R file and start coding! (Click Yes if prompted to install
sess.)
Steps 1–3 above are all that's required to get started with R in VS Code. But we also recommend the following software for a fully optimized R + VS Code experience:
-
Install an interactive plotting backend for a better R graphics experience:
-
arf: A modern R console with many features: syntax highlighting, multiline editing, vi/emacs keybindings, R version switching, etc. Successor to radian written in Rust.
-
Complementary VS Code extensions:
- Quarto: the official Quarto plugin for VS Code.
- VSCode-R-Debugger: enables VS Code's debugging facilities for R scripts.
For example, assuming that you have installed arf and jgd, your user settings.json might include:
Please consult the relevant installation wiki pages for your OS (Windows | macOS | Linux) for more detailed instructions.
-
Snippets for R and R Markdown.
-
R Language Service: Code completion, function signature, symbol highlight, document outline, formatting, definition, diagnostics, references, and more.
-
Interacting with R terminals: Sending code to terminals, running multiple terminals, working with remote servers.
-
Package development: Build, test, install, load all and other commands from devtools.
-
Keyboard shortcuts: Built-in and customizable keyboard shortcuts.
-
Workspace viewer: Environment pane to show global variables in the attached R session.
-
Help pages viewer: Viewing R help pages and searching help topics.
-
Package management: Installing and removing R packages.
-
Session symbol hover and completion.
-
Data viewer: Viewing data frames, matrices, Arrow tables, and polars data frames in a paged, sortable, filterable grid; lists in a tree view.
-
Plot viewer: Interactive plot viewer with support for jgd and httpgd backends, plus a standard PNG/SVG fallback.
-
Webpage viewer: Viewing htmlwidgets such as interactive graphics and visual profiling results.
-
Browser viewer: Viewing interactive shiny apps.
-
R Markdown support: R Markdown chunk highlighting, chunk navigation, execute commands, and preview.
-
RStudio add-in support: Run supported RStudio add-ins in VS Code with a live R session.
-
Full support of Remote Development via SSH, Containers and WSL.
-
If you have a question about accomplishing something in general with the extension, please start a discussion or ask on Stack Overflow.
-
If you find a problem or have a feature request with the extension, please find out if there is a current issue you may upvote or otherwise file an issue.
-
Contributions are always welcome! Please see the contributing guide for more details.
{ "r.consolePath": "arf", "r.bracketedPaste": true, // recommended for arf (and radian) "r.plot.backend": "jgd" // "auto" already prefers jgd, then httpgd }