{styler} for Positron
A Code OSS extension that formats R code using the {styler} package, primarily targetting Positron, since other Code OSS derivatives are compatible vscode-r extension that provides this functionality (and Positron is not). It registers a document formatting provider for R, so "Format Document" and "Format on Save" work automatically for Requirements
InstallationSearch for "{styler}: Non-Invasive Pretty Printing of R Code" in the Extensions panel is the easiest way to install it. Alternatively, download it from Open VSX. Once installed, the extension activates automatically when you open an R file. Trigger formatting with:
Positron CompatibilityThis extension is fully compatible with Positron. Positron activates
Troubleshooting"Rscript not found" — R is not installed or not on your PATH. Install R from r-project.org or set Windows: "spawn EINVAL" or "Rscript not found" even though
"Package 'styler' is not installed" — Run "Formatting timed out" — The formatter took longer than Formatting failed with a syntax error — {styler} may not be able to format files with R syntax errors. Fix the error first, then format. ConfigurationAll settings live under the
Example
|