Skip to content

Commit 08986c1

Browse files
authored
Do not contribute "r.sourceCurrentFile" affordances in an R package (#4567)
Addresses #1359 I can't think of good reasons why people would in fact want any of these affordances in an R package. Even without them, you can still do something like <kbd>Cmd</kbd>+<kbd>Enter</kbd> to get a function defined, as well as of course the better/recommended options like `devtools::load_all()`, etc. ### QA Notes After this change, - when you are in an `.R` file but _not_ in an R package, you get the command to source your current file on the editor action bar, in the context menu, and via the keybinding. - when you _are_ in an R package in an `.R` file, you do not see this command in any of these three spots. I kept the command in the command palette because it is used [in testing](https://github.com/posit-dev/positron/blob/de05c42d65938e0dfc7755d67d59eda49957ef2e/test/smoke/src/areas/positron/dataexplorer/largeDataFrame.test.ts#L99) (the testing workspaces look like R packages) and it's not _super_ prominent for users there.
1 parent a5dd049 commit 08986c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

extensions/positron-r/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@
397397
"command": "r.sourceCurrentFile",
398398
"key": "ctrl+shift+enter",
399399
"mac": "cmd+shift+enter",
400-
"when": "editorLangId == r"
400+
"when": "editorLangId == r && !isRPackage"
401401
},
402402
{
403403
"command": "r.insertSection",
@@ -485,7 +485,7 @@
485485
"command": "r.sourceCurrentFile",
486486
"group": "R",
487487
"title": "%r.command.sourceCurrentFile.title%",
488-
"when": "editorLangId == r"
488+
"when": "editorLangId == r && !isRPackage"
489489
},
490490
{
491491
"command": "r.rmarkdownRender",
@@ -500,7 +500,7 @@
500500
"group": "navigation@0",
501501
"icon": "$(play)",
502502
"title": "%r.command.sourceCurrentFile.title%",
503-
"when": "resourceLangId == r && !isInDiffEditor"
503+
"when": "resourceLangId == r && !isInDiffEditor && !isRPackage"
504504
},
505505
{
506506
"command": "r.rmarkdownRender",

0 commit comments

Comments
 (0)