Vlad
Vlad

Reputation: 3764

R in vscode - saving files command

RStudio has an api function rstudioapi::documentSaveAll() which I'm trying to replicate when running R code in VScode - is there something like vscodeapi::documentSaveAll()?

Upvotes: 1

Views: 427

Answers (1)

andycraig
andycraig

Reputation: 870

The R extension for VS Code supports many of the {rstudioapi} functions, including documentSaveAll. Install that extension and then add this line to your .Rprofile file as described here:

options(vsc.rstudioapi = TRUE)

Then you should be able to call rstudioapi::documentSaveAll() in your code and have it work in VS Code too.

The list of {rstudioapi} functions currently supported in VS Code is here: https://github.com/REditorSupport/vscode-R/wiki/RStudio-addin-support#implemented-functions

Upvotes: 1

Related Questions