Skip to content

Commit

Permalink
Improve UX when no runtimes found (#5671)
Browse files Browse the repository at this point in the history
### Description
Addresses #3468

This addresses a niche UX scenario: a user installs Positron before
completing the [machine
prerequisites](https://positron.posit.co/start.html#machine-prerequisites)
i.e. there is no R or Python installed on the machine.

The solution is quite minimal since the overall runtime startup
experience will be going through enhancements soon. A notification is
displayed to the user letting them know that no runtimes were found.
This notification is shown after the runtime discovery phase is
complete.

<img width="1342" alt="Screenshot 2024-12-09 at 9 41 33 AM"
src="https://github.com/user-attachments/assets/65e7f20d-4497-46fd-85e5-ef361f5809c7">

### QA Notes

In order to test this we'll need to install Positron in an environment
that does not have R or Python installed. This should kick off a VS Code
notification in the bottom right which lets a user know the problem and
a link to the positron wiki for resolving the issue.

---------

Signed-off-by: Dhruvi Sompura <[email protected]>
Co-authored-by: Julia Silge <[email protected]>
  • Loading branch information
dhruvisompura and juliasilge authored Dec 10, 2024
1 parent 494d345 commit fac0f76
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/vs/workbench/services/runtimeStartup/common/runtimeStartup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,18 @@ export class RuntimeStartupService extends Disposable implements IRuntimeStartup
// auto-start a runtime.
this._register(this.onDidChangeRuntimeStartupPhase(phase => {
if (phase === RuntimeStartupPhase.Complete) {
if (!this.hasAffiliatedRuntime() &&
// if no runtimes were found, notify the user about the problem
if (this._languageRuntimeService.registeredRuntimes.length === 0) {
this._notificationService.error(nls.localize('positron.runtimeStartupService.noRuntimesMessage',
"No interpreters found. Please see the [Get Started](https://positron.posit.co/start) \
documentation to learn how to prepare your Python and/or R environments to work with Positron."));
}

// If there are no affiliated runtimes, and no starting or running
// runtimes, start the first runtime that has Immediate startup
// behavior.
else if (!this.hasAffiliatedRuntime() &&
!this._runtimeSessionService.hasStartingOrRunningConsole()) {
// If there are no affiliated runtimes, and no starting or running
// runtimes, start the first runtime that has Immediate startup
// behavior.
const languageRuntimes = this._languageRuntimeService.registeredRuntimes
.filter(metadata =>
metadata.startupBehavior === LanguageRuntimeStartupBehavior.Immediate);
Expand Down Expand Up @@ -384,7 +391,7 @@ export class RuntimeStartupService extends Disposable implements IRuntimeStartup

/**
* Activates all of the extensions that provides language runtimes, then
* entires the discovery phase, in which each extension is asked to supply
* enters the discovery phase, in which each extension is asked to supply
* its language runtime metadata.
*/
private async discoverAllRuntimes() {
Expand Down

0 comments on commit fac0f76

Please sign in to comment.