From fac0f76ad19ad2d6c9aa1a03561a37f95f7f15d1 Mon Sep 17 00:00:00 2001 From: Dhruvi Sompura Date: Tue, 10 Dec 2024 09:45:37 -0800 Subject: [PATCH] Improve UX when no runtimes found (#5671) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 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. Screenshot 2024-12-09 at 9 41 33 AM ### 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 Co-authored-by: Julia Silge --- .../runtimeStartup/common/runtimeStartup.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/services/runtimeStartup/common/runtimeStartup.ts b/src/vs/workbench/services/runtimeStartup/common/runtimeStartup.ts index 46b00b75af0..9ec00719442 100644 --- a/src/vs/workbench/services/runtimeStartup/common/runtimeStartup.ts +++ b/src/vs/workbench/services/runtimeStartup/common/runtimeStartup.ts @@ -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); @@ -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() {