R extension for Visual Studio Code
A Visual Studio Code extension provides support for the R language for R 3.2+. Features include syntax checking, completions, code formatting, formatting as you type, tooltips, linting.
- Windows x64
- Mac OS 10.12+
- Linux distros supported by .NET Core 2.1 Runtime.
- On Mac and Linux extension needs native library
libzip is missing, on Mac the extension attempts to install it via Homebrew. You may also attempt to install it manually bu running
brew install libzip.
Open the Command Palette (Command+Shift+P on macOS and Ctrl+Shift+P on Windows/Linux) and type 'R:' to see list of available commands and shortcuts.
Syntax check is performed as you type or when opening a file. Look for red squiggles. Problems are also reported in the
Extension provides ability to format document or selection. Formatting options are available in the
r.editor settings section.
Automatic formatting (as you type)
The editor can format code after you type Enter, ; or }. You can control the feature via
r.editor.fornatOnType settings. Formatting settings are the same as in the document formatting.
Functionality is close to lintr. However, you do not have to run linting explicitly, it happens as you type. By default it is disabled, you can enable it by setting
true. Linter has various options available in the
Execute in terminal/source file
R: Execute line or selection commands to execute line or selection in the terminal. Similarly, use
R: source file to source file from the editor into the terminal section.
R session in the editor does not automatically pick up new packages installed in the terminal. You may have to reload the window for the session to pick up newly installed modules.
- .NET Core not found You can bypass .NET Core check by setting
dependencyChecks setting to false.
- Launching server using command dotnet failed.. Most probably libzip is missing and extensions was unable to install it. Try installing Homebrew, then run
brew install libzip.
- R Interpreter not found
The broker (ASP.NET Core process) is configurable via
Auto detect R interpreters. This option looks for installed CRAN R (>= 3.2) and Microsoft R Open (>= 3.2) packages. Default is true.
Add custom R interpreters. The format requires a name and the path to where the interpreter is installed. Example, for CRAN R the path is /usr/lib/R. Note: CRAN R is detected automatically.
See also https://github.com/Microsoft/RTVS/issues/3265
"basePath": "C:\\Program Files\\Microsoft\\MRO-3.3.2"
"name": "MSSQL R Services",
"basePath": "C:\\Program Files\\Microsoft SQL Server\\MSSQL13.MSSQL01\\R_SERVICES"
Not currently supported
- Remote or Docker connectivity
- Completions in console
- In-app Plot or other graphical output
- 32-bit R
- Dynamic update of the session when new packages are installed.
Please file issues at the project GitHub
Extension is based on Microsoft R Tools for Visual Studio aka RTVS.
Please visit https://github.com/microsoft/rtvs for more information.
Prototype extension to VS Code can be found in the RTVS repo.
This project is a personal effort and although it builds upon RTVS,
it is not supported by Microsoft. I work on the code occasionally
in my spare time.