An extremely fast R language server and code formatter, written in Rust.
Docs · Releases · VS Code Extension
Note
Roughly can be used either as a standalone command-line tool or as an extension in supported editors like VS Code.
This project was created to address the slow performance of the existing R language server on large codebases. Originally called "The R(oughly good enough) language server", it began as a minimal but fast language server that supported only go-to-definition using regex-based indexing. Since then, the project has evolved into a full-featured language server with proper parsing, formatting, and linting, and the "good enough" part was eventually dropped from the name.
Roughly aims to support the following language server features (some are experimental or in progress):
-
Formatting
- Format entire document
- Format selected code range (🧪 experimental)
-
Navigation
- Index global variables, S4 and R6 classes/methods
- Search current document - Ctrl + Shift + O in VS Code
- Search global workspace - Ctrl + T in VS Code
- Go to definition (🧪 experimental)
- Find all references (🧪 experimental)
-
Diagnostics
- Syntax errors - including missing or trailing commas
- Basic linting rules - full list here
- Warning for unused variables (🧪 experimental)
- Error for undefined variable (
⚠️ missing) - Argument validation for function calls (
⚠️ missing) - Type checking (💡 early design phase)
-
Editing
- Autocomplete local and global variables
- Autocomplete variables from other packages (
⚠️ missing) - Rename local variables (🧪 experimental)
- Rename global variables (
⚠️ missing) - Signature help (🔨 work in progress)
Run Roughly as a formatter:
roughly fmt # Format all files in the current directory
roughly fmt <path> # Format all files in `<path>`
roughly fmt --check # Only check if files would be formatted
roughly fmt --diff # Only show the diff if files would be formatted
To run Roughly as a linter:
roughly check # Check all files in the current directory
roughly check <path> # Check all files in `<path>`
Or, to run Roughly as a language server:
roughly server # Usually started automatically by your editor
Download the pre-built binary for your platform from the releases page.
If you have Cargo installed, install Roughly with:
cargo install --git https://github.com/felix-andreas/roughly roughly
Alternatively, build from source:
cargo build --release
Install the extension from the VS Code Marketplace.
Note
The VS Code extension from the marketplace includes a bundled version of the Roughly CLI only for Windows and Linux x64. If you are using macOS or a different architecture, you will need to install the Roughly CLI manually.
Alternatively, build the extension from source (or download from releases):
bun run package
Install the generated VSIX file:
code --install-extension roughly.vsix
You can customize the Roughly extension in VS Code through the following settings:
Note
For a complete list of experimental features and their descriptions, see below.
You can access Roughly-specific commands in VS Code via the Command Palette (Ctrl+Shift+P):
- Roughly: Open logs
- Roughly: Start/Stop/Restart Server
- Roughly: Format workspace (
⚠️ missing) - Roughly: Show syntax tree (
⚠️ missing)
Roughly can be used as an external formatter in RStudio. See the RStudio setup guide for detailed instructions.
You can configure Roughly via a project-specific roughly.toml
file:
[format]
# Number of spaces per indentation level
indent-width = 4
# Automatically detect the appropriate line ending
line-ending = "auto" # "lf" or "cr-lf"
[lint]
# Control the naming convention for variables and parameters
naming-style = "snake_case" # or "camelCase", omit to disable this lint entirely
Roughly includes several experimental features that can be enabled in the VS Code extension settings or via the CLI:
Name | Description |
---|---|
all |
Enable all experimental features |
goto_definition |
Jump to symbol definitions |
goto_references |
Find all references to a symbol |
range_formatting |
Format selected code ranges |
rename |
Rename symbols |
unused |
Warn about unused variables |
See our development documentation.
This repository is licensed under The Universal Permissive License Version 1.0.