REditorSupport / REditorSupport/vscode-R

Activate extension when a R script file is opened outside of a workspace

Open
#1,624 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open package.json and inspect the activationEvents array, starting with the existing workspaceContains, command, and webview entries. Add activation for the R language so a standalone R script starts the extension, then verify that opening an R file outside a workspace enables the extension's features.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.