mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 20:13:32 +01:00
window.showQuickPick is not closed when promise is rejected
This commit is contained in:
@@ -67,6 +67,10 @@ export class PluginHostQuickOpen {
|
||||
return items[handle];
|
||||
}
|
||||
});
|
||||
}, (err) => {
|
||||
this._proxy._setError(err);
|
||||
|
||||
return TPromise.wrapError(err);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -80,6 +84,7 @@ export class MainThreadQuickOpen {
|
||||
|
||||
private _quickOpenService: IQuickOpenService;
|
||||
private _doSetItems: (items: MyQuickPickItems[]) => any;
|
||||
private _doSetError: (error: Error) => any;
|
||||
private _contents: TPromise<MyQuickPickItems[]>;
|
||||
private _token = 0;
|
||||
|
||||
@@ -97,6 +102,12 @@ export class MainThreadQuickOpen {
|
||||
c(items);
|
||||
}
|
||||
};
|
||||
|
||||
this._doSetError = (error) => {
|
||||
if (myToken === this._token) {
|
||||
e(error);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return this._quickOpenService.pick(this._contents, options).then(item => {
|
||||
@@ -113,6 +124,13 @@ export class MainThreadQuickOpen {
|
||||
}
|
||||
}
|
||||
|
||||
_setError(error: Error): Thenable<any> {
|
||||
if (this._doSetError) {
|
||||
this._doSetError(error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_input(options?: InputBoxOptions): Thenable<string> {
|
||||
return this._quickOpenService.input(options);
|
||||
}
|
||||
|
||||
@@ -209,7 +209,11 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
|
||||
onOk: () => { /* ignore, handle later */ },
|
||||
onCancel: () => { /* ignore, handle later */ },
|
||||
onType: (value: string) => { /* ignore, handle later */ },
|
||||
onShow: () => this.emitQuickOpenVisibilityChange(true)
|
||||
onShow: () => this.emitQuickOpenVisibilityChange(true),
|
||||
onHide: () => {
|
||||
this.restoreFocus(); // focus back to editor or viewlet
|
||||
this.emitQuickOpenVisibilityChange(false); // event
|
||||
}
|
||||
}, {
|
||||
inputPlaceHolder: options.placeHolder || ''
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user