From f53a9d1ffebff5420bf5b76b71a7696c3b5a9c8b Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Tue, 26 Nov 2024 19:00:09 -0700 Subject: [PATCH] Use new Quarto context keys in keyboard shortcuts (#5451) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses #1955 together with https://github.com/quarto-dev/quarto/pull/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: - Alt+- to get you `<-` - Cmd/Ctrl+Shift+M to get you `|>` --- extensions/positron-r/package.json | 8 ++++---- extensions/positron-rstudio-keymap/package.json | 16 ---------------- product.json | 2 +- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/extensions/positron-r/package.json b/extensions/positron-r/package.json index 2c146562623..b8f9ca5d661 100644 --- a/extensions/positron-r/package.json +++ b/extensions/positron-r/package.json @@ -370,7 +370,7 @@ "command": "r.insertPipe", "key": "ctrl+shift+m", "mac": "cmd+shift+m", - "when": "editorLangId == r" + "when": "editorLangId == r || quarto.document.languageId == r" }, { "command": "r.insertPipeConsole", @@ -382,7 +382,7 @@ "command": "r.insertLeftAssignment", "key": "alt+-", "mac": "alt+-", - "when": "editorLangId == r" + "when": "editorLangId == r || quarto.document.languageId == r" }, { "command": "r.insertLeftAssignmentConsole", @@ -466,7 +466,7 @@ { "category": "R", "command": "r.insertPipe", - "when": "editorLangId == r" + "when": "editorLangId == r || quarto.document.languageId == r" }, { "category": "R", @@ -476,7 +476,7 @@ { "category": "R", "command": "r.insertLeftAssignment", - "when": "editorLangId == r" + "when": "editorLangId == r || quarto.document.languageId == r" }, { "category": "R", diff --git a/extensions/positron-rstudio-keymap/package.json b/extensions/positron-rstudio-keymap/package.json index 24857653f0c..2203abda747 100644 --- a/extensions/positron-rstudio-keymap/package.json +++ b/extensions/positron-rstudio-keymap/package.json @@ -178,22 +178,6 @@ "when": "config.rstudio.keymap.enable && editorLangId == r", "command": "r.sourceCurrentFileWithEcho" }, - { - "mac": "cmd+shift+m", - "win": "ctrl+shift+m", - "linux": "ctrl+shift+m", - "key": "ctrl+shift+m", - "when": "config.rstudio.keymap.enable && editorLangId == quarto", - "command": "r.insertPipe" - }, - { - "mac": "alt+-", - "win": "alt+-", - "linux": "alt+-", - "key": "alt+-", - "when": "config.rstudio.keymap.enable && editorLangId == quarto", - "command": "r.insertLeftAssignment" - }, { "mac": "ctrl+alt+left", "win": "ctrl+alt+left", diff --git a/product.json b/product.json index a8492c9abba..19eebb6a5af 100644 --- a/product.json +++ b/product.json @@ -208,7 +208,7 @@ }, { "name": "quarto.quarto", - "version": "1.114.0", + "version": "1.118.0", "repo": "https://github.com/quarto-dev/quarto/tree/main/apps/vscode", "metadata": { "id": "a1be81fc-0f3a-4f2e-92ee-3fdc7ab96c73",