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

Add new R extension quickpick to select an interpreter #6213

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

juliasilge
Copy link
Contributor

@juliasilge juliasilge commented Feb 1, 2025

Addresses #5223

We do have a language agnostic way to generate this kind of feature, as implemented in #3213, but our experience with the "Python: Select Interpreter" command highlights that making these language specific is pretty helpful.

What this PR gets us for R (beyond the existing functionality) now is:

  • Kick the R discovery process without reloading the whole app
  • More control on how various R runtimes are presented (for example, system R at the top of the list)

What we could add in the future includes:

  • Show non-usable R installations

Related to the upcoming multiple sessions work and changes to the interpreter dropdown, we'll need to add to the Positron API for extensions so that extensions can say, "Here is my command to select an interpreter", and we can use r.selectInterpreter together with python.setInterpreter. cc @dhruvisompura

Let's run the @:console tests.

Release Notes

New Features

  • New "R: Select Interpreter" command to see all options for R interpreters and choose one.

Bug Fixes

  • N/A

QA Notes

  • Start off by uninstalling your release version of R and having some older versions of R installed.
  • Run Positron and note that the interpreter dropdown shows your installed R versions.
  • Run "R: Select Interpreter" and start/switch to different interpreters.
  • Leaving Positron open and running, go to the terminal and install R from brew via brew install r.
  • Note that this new version of R does not appear in the interpreter dropdown; Positron doesn't know about it.
  • Run "R: Select Interpreter" and note that you do see the new homebrew R:

Screenshot 2025-01-31 at 2 57 19 PM

  • Choose the new homebrew R and notice that it starts (we are registering it on the fly).

When you are done, do brew uninstall r because you certainly do not want that R brew installation hanging around. 😆

Copy link

github-actions bot commented Feb 1, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:console

readme  valid tags

Comment on lines +36 to +39
export enum RRuntimeSource {
system = 'System',
user = 'User',
homebrew = 'Homebrew',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this enum to use here and also in the quickpick, for display purposes.


// R discovery is fast so we just do it before rendering the quick pick
const runtimePicks: RuntimeQuickPickItem[] = [];
const discoverer = rRuntimeDiscoverer();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting up the quickpick triggers discovery again. Since this is so fast for R, I think this will be more aligned with folks' expectations than a not-entirely-prominent refresh button.


// If we did in fact get a runtime from the user, select and start it
if (runtime) {
const registeredRuntimes = await positron.runtime.getRegisteredRuntimes();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of getting all the registered runtimes and checking whether ours is in it, we could just always re-register the selected one? I don't think it generates errors to register a runtime again.

@juliasilge
Copy link
Contributor Author

Let's run the console tests since this command is used here: @:console

@juliasilge juliasilge marked this pull request as ready for review February 1, 2025 18:22
@juliasilge juliasilge requested a review from jmcphers February 1, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant