Activate extension when a R script file is opened outside of a workspace
Is your feature request related to a problem? Please describe.
I often use the vscode-R extension without opening a workspace. Currently, the vscode-R extension is activated when a workspace containing R scripts is opened. The extension does not activate when opening a single R script file outside of a workspace. This means that I have to force the extension to activate so that I can have the autocomplete and popup help features working. I force the extension to activate by opening the R Help feature which I think works due to the onWebviewPanel:rhelp activation event.
Describe the solution you'd like
The following patch to the package.json file activates the extension when an R script file is opened outside of a workspace folder. Having the onLanguage:r line is consistent with other extensions, namely the Python and C/C++ extensions from Microsoft.
--- package.json.orig 2025-07-04 08:48:57.676941500 -0500
+++ package.json 2025-07-04 08:51:26.174039600 -0500
@@ -31,7 +31,8 @@
"activationEvents": [
"workspaceContains:**/*.{rproj,Rproj,r,R,rd,Rd,rmd,Rmd}",
"onCommand:r.runSelectionInActiveTerm",
- "onWebviewPanel:rhelp"
+ "onWebviewPanel:rhelp",
+ "onLanguage:r"
],
"main": "./dist/extension",
"contributes": {
Describe alternatives you've considered
Force the vscode-R extension to activate by opening the R Help feature in the extension. Not ideal as it involves an extra step. The above patch makes the extension available seamlessly when working outside of vscode workspaces.
Additional context