posit-dev / positron

Positron, a next-generation data science IDE
Other
2.09k stars 63 forks source link

Support language keyboard shortcuts in Quarto chunks #1955

Open blairj09 opened 7 months ago

blairj09 commented 7 months ago

With an open R file, cmd+shift+m will automatically insert R pipe (|>). However, in an R code chunk within a Quarto document, the same shortcut instead opens the PROBLEMS panel. The VS Code keyboard shorcuts doc indicates that this is the expected behavior for this keybinding in VS Code: image However, it feels like Quarto chunks should prioritize language-specific key bindings. I intentionally left this issue title a bit vague in case there are other bindings that don't function as expected from within quarto chunks.

juliasilge commented 7 months ago

Currently our rules for the pipe shortcut say editorLangId == r:

https://github.com/posit-dev/positron/blob/de7666b74f2e3f2adfca059b6dc841ae3c6e9d86/extensions/positron-r/package.json#L32-L36

I don't know what Quarto currently gives us for editorLangId, given that it can be R, Python, etc.

Just to link these up, we are tracking some other related issues about Quarto and language features:

jennybc commented 7 months ago

Some research ...

I just created a new Quarto document in positron and added an R chunk. With the cursor inside that chunk, I inspected context keys. editorLangId is 'quarto' and editorTextFocus is true.

https://code.visualstudio.com/api/references/when-clause-contexts#inspect-context-keys-utility

Screenshot 2023-12-15 at 1 46 06 PM
juliasilge commented 5 months ago

This came up during usability testing with @gadenbuie today, and is a reason he shies away from using Quarto in Positron and/or VS Code.

juliasilge commented 3 months ago

This came up in our private beta here: https://github.com/posit-dev/positron-beta/discussions/90

Should we do something easy and quick in the short term, like add the pipe shortcut to the RStudio keymap?

juliasilge commented 1 month ago

After #3523 we have the shortcuts for |> and <- provided for Quarto files in the RStudio Keymap but in the long term we would like to support language keyboard shortcuts generally in Quarto chunks.