Set an IDE or editor up to use the R in the project's Pixi environment. use_pixi()
calls these with its ide argument.
use_pixi_rstudio()adds, or replaces, anrstudiotask inpixi.tomlthat starts a new RStudio with the environment's R and the project's.Rprojfile, on Linux, macOS and Windows (linux-64,osx-64,osx-arm64andwin-64). Pixi adds any of those platforms the project doesn't have. It creates the.Rprojfile if there isn't one. Start RStudio withpixi run rstudio.use_pixi_positron()turns on Positron's discovery of R in Pixi environments, and makes the default environment's R Positron's default for the project, in.vscode/settings.json. Positron (2026.10 or later) then starts that R when the project opens, until you pick another R there. The path is for the operating system you run it on; on another one, Positron ignores it.use_pixi_vscode()adds languageserver, the R extension's sess (how it talks to R) and jgd (its plots), and the console if it isn't R, to the environment. sess and jgd come from the rpix-forge channel until they're on conda-forge; it's added to the project's channels after conda-forge. It points the R extension for VS Code, and the editors based on it such as VSCodium, Cursor and Windsurf, at the environment's R and the console, in.vscode/settings.json. On Windows, the environment's R only starts when the environment is activated, so it leaves R and the console to be found on thePATHinstead: start VS Code withpixi run code .(orcodium,cursororwindsurfinstead ofcode).use_pixi_emacs(),use_pixi_neovim()anduse_pixi_zed()add languageserver to the environment, and a.envrcthat activates the environment with direnv (seeuse_pixi_direnv()). The editor, or the shell it starts from, then finds the environment's R and languageserver on thePATH: Emacs with its envrc package, Neovim from a shell with direnv's hook or with a direnv plugin, and Zed by itself. On Windows, start the editor from the environment instead, e.g. withpixi run nvim.
In an interactive session, use_pixi_vscode() asks which console to use,
unless console is given. Otherwise it keeps the console already set up,
or R.
Existing settings in .vscode/settings.json are kept. In a package,
.vscode is added to .Rbuildignore.
Usage
use_pixi_rstudio(path = NULL)
use_pixi_positron(path = NULL, default_r = TRUE)
use_pixi_vscode(path = NULL, console = NULL)
use_pixi_emacs(path = NULL)
use_pixi_neovim(path = NULL)
use_pixi_zed(path = NULL)Examples
# A throwaway Pixi project in R's temporary folder, so the examples leave
# yours alone. With `dry_run = TRUE`, rpix shows the Pixi command it would run.
project <- file.path(tempdir(), "rpix-example")
dir.create(project, showWarnings = FALSE)
writeLines(
c(
"[workspace]",
'name = "rpix-example"',
'channels = ["conda-forge"]',
'platforms = ["linux-64", "osx-arm64", "win-64"]',
"",
"[dependencies]",
'r-base = "4.5.*"',
'conda-ecosystem-user-package-isolation = "*"'
),
file.path(project, "pixi.toml")
)
use_pixi_positron(path = project)
#> ✔ Updated .vscode/settings.json.
#> ℹ Positron (2026.10 or later) now starts the project's R when you open the project; restart it if it's open. If you've picked another R in this project before, pick "R (Pixi: default)" once.
if (FALSE) { # \dontrun{
# These need Pixi, and add packages to the project
use_pixi_rstudio()
use_pixi_vscode(console = "arf")
use_pixi_neovim()
} # }