REditorSupport / REditorSupport/vscode-R
provide rstudio-like keymaps
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 139
- Avg merge
- 2h 46m
- Merged PRs (30d)
- 5
Description
Describe the solution you'd like
I'd love it if there was a way to quickly get the key bindings that I (and I suspect many others) have muscle-memoried from RStudio.
Caveats:
- This should only cover R-specific keybindings, such as for
devtools::load_all()orR CMD checkand not the general-purpose IDE/Editor bindings (i.e. CTRL+1 for "move to source editor".
VSCode is a different beast and has a completely different design, so it doesn't make sense for it to behave like RStudio all around.
As a heuristic, only those keybindings should be enabled which only make sense inside R projects.
If there's already a native, cross-language VSCode shortcut, that should take precedence. - Consequently, this should only trigger when
"when": "editorLangId == r || editorLangId == rmd && editorTextFocus". - Some default VSCode keybindings would have to be overwritten (see below).
- The whole thing could maybe be enabled as an option in the setting.
Here's what I have so far (using tasks as per #59):
{
"description": "Insert <-",
"key": "alt+-",
"command": "type",
"when": "editorLangId == r || editorLangId == rmd && editorTextFocus",
"args": {
"text": "<- "
}
},
{
"description": "Insert %>%",
"key": "ctrl+shift+m",
"command": "type",
"when": "editorLangId == r || editorLangId == rmd && editorTextFocus",
"args": {
"text": "%>% "
}
},
{
// "description": "Disable (overloaded with above)",
"key": "ctrl+shift+m",
"when": "editorLangId == r || editorLangId == rmd && editorTextFocus",
"command": "-workbench.actions.view.problems"
},
{
"description": "Load all",
"key": "cmd+shift+l",
"command": "r.runCommand",
"when": "editorLangId == r || editorLangId == rmd",
"args": "devtools::load_all()"
},
{
"description": "Test",
"key": "cmd+shift+t",
"command": "workbench.action.tasks.runTask",
"when": "editorLangId == r || editorLangId == rmd",
"args": "Test"
},
{
"description": "Document",
"key": "cmd+shift+d",
"command": "workbench.action.tasks.runTask",
"when": "editorLangId == r || editorLangId == rmd",
"args": "Document"
},
{
"description": "Check",
"key": "cmd+shift+e",
"command": "workbench.action.tasks.runTask",
"when": "editorLangId == r || editorLangId == rmd",
"args": "Check"
},
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing r.runCommand and workbench.action.tasks.runTask integrations used by the proposed bindings. Compare the RStudio-specific shortcuts and their R/Rmd when conditions, then determine how an optional setting should enable them. Done means the requested R-specific mappings work without replacing native cross-language VS Code shortcuts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r, typescript, vscode
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100