提交 0e6ec37f 编写于 作者: B Benjamin Pasero

commands - do not always wait for extensions

上级 f44e51ed
...@@ -377,7 +377,8 @@ export class CommandsHandler extends QuickOpenHandler { ...@@ -377,7 +377,8 @@ export class CommandsHandler extends QuickOpenHandler {
private commandHistoryEnabled: boolean; private commandHistoryEnabled: boolean;
private commandsHistory: CommandsHistory; private commandsHistory: CommandsHistory;
private extensionsRegistered: boolean;
private waitedForExtensionsRegistered: boolean;
constructor( constructor(
@IEditorService private readonly editorService: IEditorService, @IEditorService private readonly editorService: IEditorService,
...@@ -391,7 +392,7 @@ export class CommandsHandler extends QuickOpenHandler { ...@@ -391,7 +392,7 @@ export class CommandsHandler extends QuickOpenHandler {
this.commandsHistory = this.instantiationService.createInstance(CommandsHistory); this.commandsHistory = this.instantiationService.createInstance(CommandsHistory);
this.extensionService.whenInstalledExtensionsRegistered().then(() => this.extensionsRegistered = true); this.extensionService.whenInstalledExtensionsRegistered().then(() => this.waitedForExtensionsRegistered = true);
this.configurationService.onDidChangeConfiguration(e => this.updateConfiguration()); this.configurationService.onDidChangeConfiguration(e => this.updateConfiguration());
this.updateConfiguration(); this.updateConfiguration();
...@@ -402,7 +403,7 @@ export class CommandsHandler extends QuickOpenHandler { ...@@ -402,7 +403,7 @@ export class CommandsHandler extends QuickOpenHandler {
} }
getResults(searchValue: string, token: CancellationToken): Promise<QuickOpenModel> { getResults(searchValue: string, token: CancellationToken): Promise<QuickOpenModel> {
if (this.extensionsRegistered) { if (this.waitedForExtensionsRegistered) {
return this.doGetResults(searchValue, token); return this.doGetResults(searchValue, token);
} }
...@@ -410,7 +411,11 @@ export class CommandsHandler extends QuickOpenHandler { ...@@ -410,7 +411,11 @@ export class CommandsHandler extends QuickOpenHandler {
// a chance to register so that the complete set of commands shows up as result // a chance to register so that the complete set of commands shows up as result
// We do not want to delay functionality beyond that time though to keep the commands // We do not want to delay functionality beyond that time though to keep the commands
// functional. // functional.
return Promise.race([timeout(800), this.extensionService.whenInstalledExtensionsRegistered().then(() => undefined)]).then(() => this.doGetResults(searchValue, token)); return Promise.race([timeout(800), this.extensionService.whenInstalledExtensionsRegistered().then(() => undefined)]).then(() => {
this.waitedForExtensionsRegistered = true;
return this.doGetResults(searchValue, token);
});
} }
private doGetResults(searchValue: string, token: CancellationToken): Promise<QuickOpenModel> { private doGetResults(searchValue: string, token: CancellationToken): Promise<QuickOpenModel> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册