Skip to content

Commit 4b70a78

Browse files
authored
Fix up runtime discovery with progress notification and improved user feedback (#9247)
Addresses #8404 With this PR, we now show a progress notification when users explicitly call _Interpreter: Discover All Interpreters_. It looks like this while discovery is going on (which can take a while, but if a user really explicitly said to do this, probably the right option): <img width="1368" height="994" alt="Screenshot 2025-09-01 at 3 20 49 PM" src="https://github.com/user-attachments/assets/78ca42b0-38f5-4e79-a7ed-19a7dc26dec6" /> If nothing new is found, the progress notification resolves and then you see this: <img width="1368" height="994" alt="Screenshot 2025-09-01 at 3 21 04 PM" src="https://github.com/user-attachments/assets/235a0614-e208-4eb4-98b7-5900d0e12573" /> If something new _is_ found, the progress notification resolves and then you see this: <img width="1368" height="994" alt="Screenshot 2025-09-01 at 3 22 41 PM" src="https://github.com/user-attachments/assets/30aec486-28fd-4bde-835f-9f2764973439" /> ### Release Notes <!-- Optionally, replace `N/A` with text to be included in the next release notes. The `N/A` bullets are ignored. If you refer to one or more Positron issues, these issues are used to collect information about the feature or bugfix, such as the relevant language pack as determined by Github labels of type `lang: `. The note will automatically be tagged with the language. These notes are typically filled by the Positron team. If you are an external contributor, you may ignore this section. --> #### New Features - Improved user feedback when using the command _Interpreter: Discover All Interpreters_. #### Bug Fixes - N/A ### QA Notes The command _Interpreter: Discover All Interpreters_ will not run unless the first round of discovery is done, which runs quietly in the background. This may take longer than you expect. Once you _can_ run it: - Look at all your interpreter options in Positron - Add a new one via the regular terminal (for example, a new rig version) - Look at all your interpreter choices and see that your new one is not there yet - Execute the command, and note the new progress notification - Look at all your interpreter choices and see that now the new one is there - Execute the command again, and see the same progress notification - Note the message telling you nothing new was found
1 parent f75f01b commit 4b70a78

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

src/vs/workbench/services/runtimeStartup/common/runtimeStartup.ts

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { ExtensionsRegistry } from '../../extensions/common/extensionsRegistry.j
1919
import { ExtensionIdentifier } from '../../../../platform/extensions/common/extensions.js';
2020
import { ILifecycleService, ShutdownReason } from '../../lifecycle/common/lifecycle.js';
2121
import { INotificationService, Severity } from '../../../../platform/notification/common/notification.js';
22+
import { IProgressService, ProgressLocation } from '../../../../platform/progress/common/progress.js';
2223
import { IWorkspaceTrustManagementService } from '../../../../platform/workspace/common/workspaceTrust.js';
2324
import { URI } from '../../../../base/common/uri.js';
2425
import { IWorkspaceContextService, WorkbenchState } from '../../../../platform/workspace/common/workspace.js';
@@ -128,6 +129,7 @@ export class RuntimeStartupService extends Disposable implements IRuntimeStartup
128129
@ILogService private readonly _logService: ILogService,
129130
@INotificationService private readonly _notificationService: INotificationService,
130131
@IPositronNewFolderService private readonly _newFolderService: IPositronNewFolderService,
132+
@IProgressService private readonly _progressService: IProgressService,
131133
@IRuntimeSessionService private readonly _runtimeSessionService: IRuntimeSessionService,
132134
@IStorageService private readonly _storageService: IStorageService,
133135
@IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService,
@@ -662,39 +664,49 @@ export class RuntimeStartupService extends Disposable implements IRuntimeStartup
662664
return;
663665
}
664666

665-
// Set up event to notify when runtimes are added.
667+
// Remember the old set of runtimes so we can report any new ones
666668
const oldRuntimes = this._languageRuntimeService.registeredRuntimes;
667-
this._register(
668-
this._languageRuntimeService.onDidChangeRuntimeStartupPhase(
669-
(phase) => {
669+
this._logService.debug('[Runtime startup] Refreshing runtime discovery.');
670+
this._discoveryCompleteByExtHostId.forEach((_, extHostId, m) => {
671+
m.set(extHostId, false);
672+
});
673+
674+
// Start progress for the discovery process
675+
await this._progressService.withProgress({
676+
location: ProgressLocation.Notification,
677+
title: nls.localize('positron.runtimeStartupService.discoveringRuntimes', 'Discovering interpreters...'),
678+
cancellable: false
679+
}, async (progress) => {
680+
// Start the discovery process
681+
this.discoverAllRuntimes();
682+
683+
// Wait for discovery to complete
684+
await new Promise<void>((resolve) => {
685+
const disposable = this._languageRuntimeService.onDidChangeRuntimeStartupPhase(phase => {
670686
if (phase === RuntimeStartupPhase.Complete) {
671687
const newRuntimes = this._languageRuntimeService.registeredRuntimes;
672688
const addedRuntimes = newRuntimes.filter(newRuntime => {
673689
return !oldRuntimes.some(oldRuntime => {
674690
return oldRuntime.runtimeId === newRuntime.runtimeId;
675691
});
676692
});
677-
678-
// If any runtimes were added, show a notification.
693+
// Use addedRuntimes here and resolve the promise
679694
if (addedRuntimes.length > 0) {
680695
this._notificationService.info(nls.localize('positron.runtimeStartupService.runtimesAddedMessage',
681696
"Found {0} new interpreter{1}: {2}.",
682697
addedRuntimes.length,
683698
addedRuntimes.length > 1 ? 's' : '',
684699
addedRuntimes.map(runtime => { return runtime.runtimeName; }).join(', ')));
700+
} else {
701+
this._notificationService.info(nls.localize('positron.runtimeStartupService.noNewRuntimesMessage',
702+
"No new interpreters found."));
685703
}
704+
resolve();
705+
disposable.dispose();
686706
}
687-
}
688-
)
689-
);
690-
691-
this._logService.debug('[Runtime startup] Refreshing runtime discovery.');
692-
this._discoveryCompleteByExtHostId.forEach((_, extHostId, m) => {
693-
m.set(extHostId, false);
707+
});
708+
});
694709
});
695-
696-
this.discoverAllRuntimes();
697-
698710
}
699711

700712
/**

0 commit comments

Comments
 (0)