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()
?
Asked
Active
Viewed 144 times
1

Vlad
- 3,058
- 4
- 25
- 53
-
Perhaps some insigth can be brought from [this](https://github.com/REditorSupport/languageserver) package – Ric Nov 05 '22 at 21:49
-
Also i never use vscode but [workbench.action.files.saveAll](https://stackoverflow.com/questions/37014171/how-can-we-save-all-files-in-vscode-like-we-do-in-visual-studio) appears to be the key – Ric Nov 05 '22 at 21:57
1 Answers
1
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

andycraig
- 710
- 5
- 18