Skip to content

Getting Started

Installation and basic setup for Roughly

This guide will walk you through installing and configuring Roughly for your R projects.

  1. Download the pre-built binary for your platform from the GitHub Releases page
  2. Add the binary to your system PATH

Roughly provides several commands to format code, check for issues, and run a language server:

Terminal window
# Format R files
roughly fmt # Format files in current directory
roughly fmt path/to/files # Format files at the specific path
# Check for issues
roughly check # Lint files in current directory
# Run the language server
roughly server # Start the LSP server

Roughly can also be used as a VS Code extension.

Install the extension from the VS Code Marketplace.

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):

Terminal window
bun run package

Install the generated VSIX file:

Terminal window
code --install-extension roughly.vsix

You can configure Roughly as an external formatter in RStudio:

  1. Open RStudio and navigate to:

    Options > Code > Formatting > Format with an External Tool

    Set the reformat command to: path/to/roughly fmt

  2. To enable format-on-save, go to:

    Options > Code > Saving > Format with an External Tool

    Check the Reformat documents on save option

For detailed configuration options, see the Configuration documentation.