Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new Quarto context keys in keyboard shortcuts #5451

Merged
merged 4 commits into from
Nov 27, 2024

Conversation

juliasilge
Copy link
Contributor

@juliasilge juliasilge commented Nov 22, 2024

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:

  • Alt+- to get you <-
  • Cmd/Ctrl+Shift+M to get you |>

@ntluong95

This comment was marked as off-topic.

@juliasilge

This comment was marked as off-topic.

@juliasilge
Copy link
Contributor Author

Oh, and additionally, hopefully we can use these context keys in visual mode too eventually, related to #1805.

@juliasilge
Copy link
Contributor Author

Kicked off a build to make Mac release builds here, to check the Quarto extension bundling:
https://github.com/posit-dev/positron-builds/actions/runs/12039692304

@juliasilge juliasilge marked this pull request as ready for review November 26, 2024 22:24
Copy link
Member

@jennybc jennybc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

In a .qmd with R chunks, inside one of those chunks, Alt+- produces <- and Cmd/Ctrl+Shift+M produces |>. With cursor inside an R chunk, the context key inspector shows quarto.document.languageId: "r".

In a .qmd with Python chunks, inside one of those chunks, Alt+- produces - and Cmd/Ctrl+Shift+M focuses PROBLEMS. With cursor inside a Python chunk, the context key inspector shows quarto.document.languageId: "python".

@juliasilge juliasilge merged commit f53a9d1 into main Nov 27, 2024
4 checks passed
@juliasilge juliasilge deleted the language-specific-shortcuts-in-quarto branch November 27, 2024 02:00
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants