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

Ark: UI Comm: executeCode() should use something more precise than languageId #3030

Open
DavisVaughan opened this issue May 6, 2024 · 4 comments
Labels
bug Something isn't working lang: r
Milestone

Comments

@DavisVaughan
Copy link
Contributor

DavisVaughan commented May 6, 2024

If you open two R sessions:

  • One console R
  • One notebook R

and then in the notebook R session you call rstudioapi::sendToConsole(), then that will hilariously send the text to the console R session rather than the active notebook R session.

This is a result of us using the languageId as our guide of where to execute the code, but that ends up always resolving to a console session, and never a notebook session.

const positronConsoleInstance = this._positronConsoleInstancesByLanguageId.get(languageId);

It may also be the fault of our rstudioapi shims in ark. It is possible we should error if we detect that we are in notebook "session mode" rather than console session mode and we call an rstudioapi shim, like this in just a typical terminal R session

> rstudioapi::sendToConsole("hi")
Error: RStudio not running
Screenshot 2024-05-06 at 5 01 05 PM
@DavisVaughan DavisVaughan added bug Something isn't working lang: r labels May 6, 2024
@juliasilge
Copy link
Contributor

I mean, rstudioapi::sendToConsole() did send the code to the console. 😆

@petetronic petetronic added this to the Future milestone May 13, 2024
@petetronic
Copy link
Collaborator

From Triage, can you help us understand what you're trying to do and the expected behavior?

@DavisVaughan
Copy link
Contributor Author

I'm worried that anyone working in an ipynb or another notebook will run something that triggers an rstudioapi command in that notebook, but the command ends up getting executed in their Console R session rather than the Notebook R session

It is possible that in ark we just need to not allow parts of the rstudioapi like executeCode() if we detect we are in "notebook" mode rather than "console" mode, because in notebook mode there isn't really a console to execute in.

@juliasilge
Copy link
Contributor

This will come up as we work on #3173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lang: r
Projects
None yet
Development

No branches or pull requests

3 participants