You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
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
changed the title
Identify if focus is console or text editor
Identify if focus is console or text editor via rstudioapi
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:
getActiveDocumentContext()
not consistent with rstudioapi when no document is open #2191id
in rstudioapi shims #2571 - focuses on$id
I'm not sure how it all works under the hood but the VS Code context keys
editorFocus
andterminalFocus
might be able to help.Here's a comparison between Positron (great name btw) and RStudio
The text was updated successfully, but these errors were encountered: