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

Identify if focus is console or text editor via rstudioapi #3941

Open
rjake opened this issue Jul 9, 2024 · 1 comment
Open

Identify if focus is console or text editor via rstudioapi #3941

rjake opened this issue Jul 9, 2024 · 1 comment
Labels
enhancement New feature or request lang: r
Milestone

Comments

@rjake
Copy link

rjake commented Jul 9, 2024

I want to know if I'm currently in the console or in a text editor. I used to use getActiveDocumentContext() to determine this and either send code to the console or add the code to the file I am editing. Right now, running this function from the console and text editor return the same list of values. I see that $id has been identified as an issue (below), but not sure about the other items ($path, etc).

I saw these issues and PRs that seem related:

I'm not sure how it all works under the hood but the VS Code context keys editorFocus and terminalFocus might be able to help.

Here's a comparison between Positron (great name btw) and RStudio

  • image
@rjake rjake added the enhancement New feature or request label Jul 9, 2024
@juliasilge
Copy link
Contributor

Yep, this is mostly the same as #2571, and we also will need to look at path at that time as well. We can leave this issue open for the examples to check. Thanks!

Side note: we do have the context key positronConsoleFocused which tells you if, as it says, the console is focused. You can use this today in keyboard shortcuts, tasks, etc like "when": "positronConsoleFocused" but don't currently expose this via the rstudioapi R package functions.

@juliasilge juliasilge changed the title Identify if focus is console or text editor Identify if focus is console or text editor via rstudioapi Jul 9, 2024
@juliasilge juliasilge added this to the Future milestone Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lang: r
Projects
None yet
Development

No branches or pull requests

2 participants