提交 5dbc95b0 编写于 作者: B Benjamin Pasero

window.showQuickPick is not closed when promise is rejected

上级 4a85ac57
......@@ -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 || ''
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册