window.showQuickPick is not closed when promise is rejected

This commit is contained in:
Benjamin Pasero
2015-11-26 09:37:16 +01:00
parent 4a85ac575c
commit 5dbc95b077
2 changed files with 23 additions and 1 deletions

View File

@@ -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);
}