Skip to content

Commit f53a9d1

Browse files
authored
Use new Quarto context keys in keyboard shortcuts (#5451)
Addresses #1955 together with quarto-dev/quarto#608 The Quarto PR provides new context keys for the main language of a Quarto document (for example, R or Python) and we can consume those to provide keyboard shortcuts. There are really only a couple of R ones that we want right now which means that there is no real change here in an R `.qmd` in behavior compared to what is in the RStudio Keymap. 🙈 However, I think this is still worth getting in since we've gone to the trouble of figuring it out, it lets us offer these without the RStudio Keymap being on, we can offer them _only_ in R `.qmd` files (right now, these also show up in Python `.qmd` files if you have the RStudio Keymap on), and we can use this infrastructure in the future. I did remove these from the RStudio Keymap just to clean things up, but it wouldn't hurt _a lot_ to keep them, if there is some reason I am not thinking of? If we do want to remove them, we'll need to do a Quarto release and update the bundled Quarto VS Code extension version in this PR to keep these keybindings functional. ### QA Notes With the new version of the Quarto extension (updated here), you can use the keyboard shortcuts for the pipe and assignment operator in R Quarto documents but not Python ones: - <kbd>Alt</kbd>+<kbd>-</kbd> to get you `<-` - <kbd>Cmd/Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd> to get you `|>`
1 parent 54cbc06 commit f53a9d1

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

extensions/positron-r/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@
370370
"command": "r.insertPipe",
371371
"key": "ctrl+shift+m",
372372
"mac": "cmd+shift+m",
373-
"when": "editorLangId == r"
373+
"when": "editorLangId == r || quarto.document.languageId == r"
374374
},
375375
{
376376
"command": "r.insertPipeConsole",
@@ -382,7 +382,7 @@
382382
"command": "r.insertLeftAssignment",
383383
"key": "alt+-",
384384
"mac": "alt+-",
385-
"when": "editorLangId == r"
385+
"when": "editorLangId == r || quarto.document.languageId == r"
386386
},
387387
{
388388
"command": "r.insertLeftAssignmentConsole",
@@ -466,7 +466,7 @@
466466
{
467467
"category": "R",
468468
"command": "r.insertPipe",
469-
"when": "editorLangId == r"
469+
"when": "editorLangId == r || quarto.document.languageId == r"
470470
},
471471
{
472472
"category": "R",
@@ -476,7 +476,7 @@
476476
{
477477
"category": "R",
478478
"command": "r.insertLeftAssignment",
479-
"when": "editorLangId == r"
479+
"when": "editorLangId == r || quarto.document.languageId == r"
480480
},
481481
{
482482
"category": "R",

extensions/positron-rstudio-keymap/package.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,6 @@
178178
"when": "config.rstudio.keymap.enable && editorLangId == r",
179179
"command": "r.sourceCurrentFileWithEcho"
180180
},
181-
{
182-
"mac": "cmd+shift+m",
183-
"win": "ctrl+shift+m",
184-
"linux": "ctrl+shift+m",
185-
"key": "ctrl+shift+m",
186-
"when": "config.rstudio.keymap.enable && editorLangId == quarto",
187-
"command": "r.insertPipe"
188-
},
189-
{
190-
"mac": "alt+-",
191-
"win": "alt+-",
192-
"linux": "alt+-",
193-
"key": "alt+-",
194-
"when": "config.rstudio.keymap.enable && editorLangId == quarto",
195-
"command": "r.insertLeftAssignment"
196-
},
197181
{
198182
"mac": "ctrl+alt+left",
199183
"win": "ctrl+alt+left",

product.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
},
209209
{
210210
"name": "quarto.quarto",
211-
"version": "1.114.0",
211+
"version": "1.118.0",
212212
"repo": "https://github.com/quarto-dev/quarto/tree/main/apps/vscode",
213213
"metadata": {
214214
"id": "a1be81fc-0f3a-4f2e-92ee-3fdc7ab96c73",

0 commit comments

Comments
 (0)