Skip to content

Commit 0e6ec37

Browse files
author
Benjamin Pasero
committed
commands - do not always wait for extensions
1 parent f44e51e commit 0e6ec37

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ export class CommandsHandler extends QuickOpenHandler {
377377

378378
private commandHistoryEnabled: boolean;
379379
private commandsHistory: CommandsHistory;
380-
private extensionsRegistered: boolean;
380+
381+
private waitedForExtensionsRegistered: boolean;
381382

382383
constructor(
383384
@IEditorService private readonly editorService: IEditorService,
@@ -391,7 +392,7 @@ export class CommandsHandler extends QuickOpenHandler {
391392

392393
this.commandsHistory = this.instantiationService.createInstance(CommandsHistory);
393394

394-
this.extensionService.whenInstalledExtensionsRegistered().then(() => this.extensionsRegistered = true);
395+
this.extensionService.whenInstalledExtensionsRegistered().then(() => this.waitedForExtensionsRegistered = true);
395396

396397
this.configurationService.onDidChangeConfiguration(e => this.updateConfiguration());
397398
this.updateConfiguration();
@@ -402,15 +403,19 @@ export class CommandsHandler extends QuickOpenHandler {
402403
}
403404

404405
getResults(searchValue: string, token: CancellationToken): Promise<QuickOpenModel> {
405-
if (this.extensionsRegistered) {
406+
if (this.waitedForExtensionsRegistered) {
406407
return this.doGetResults(searchValue, token);
407408
}
408409

409410
// If extensions are not yet registered, we wait for a little moment to give them
410411
// a chance to register so that the complete set of commands shows up as result
411412
// We do not want to delay functionality beyond that time though to keep the commands
412413
// functional.
413-
return Promise.race([timeout(800), this.extensionService.whenInstalledExtensionsRegistered().then(() => undefined)]).then(() => this.doGetResults(searchValue, token));
414+
return Promise.race([timeout(800), this.extensionService.whenInstalledExtensionsRegistered().then(() => undefined)]).then(() => {
415+
this.waitedForExtensionsRegistered = true;
416+
417+
return this.doGetResults(searchValue, token);
418+
});
414419
}
415420

416421
private doGetResults(searchValue: string, token: CancellationToken): Promise<QuickOpenModel> {

0 commit comments

Comments
 (0)