posit-dev / posit-dev/positron
Ark: UI Comm: `executeCode()` should use something more precise than `languageId`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 195
Description
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.
https://github.com/posit-dev/positron/blob/2e3827dc380386435dfd3afb443726761eda63e6/src/vs/workbench/services/positronConsole/browser/positronConsoleService.ts#L401
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/vs/workbench/services/positronConsole/browser/positronConsoleService.ts near executeCode and inspect the Ark rstudioapi shims mentioned in the issue. Reproduce the two-R-session case with one console and one notebook session, then determine whether the shim should target the notebook session or report an error in notebook session mode. Done means the behavior no longer sends code to the wrong session and is covered by an appropriate verification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r, typescript
- Domain
- backend, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100