提交 f5a0ea60 编写于 作者: J Johannes Rieken

WinJS.Promise#as is not what you think it is, use wrap instead - fixes #11754

上级 46c86891
......@@ -232,6 +232,20 @@ suite('window namespace tests', () => {
return result;
});
test('showQuickPick, native promise - #11754', function () {
const data = new Promise<string[]>(resolve => {
resolve(['a', 'b', 'c']);
});
const source = new CancellationTokenSource();
const result = window.showQuickPick(data, undefined, source.token);
source.cancel();
return result.then(value => {
assert.equal(value, undefined);
});
});
test('editor, selection change kind', () => {
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => window.showTextDocument(doc)).then(editor => {
......
......@@ -85,6 +85,10 @@ export declare class TPromise<V> {
public static join<ValueType>(promises:Thenable<ValueType>[]):Thenable<ValueType[]>;
public static join<ValueType>(promises: {[n:string]:TPromise<ValueType>}):TPromise<{[n:string]:ValueType}>;
public static any<ValueType>(promises:TPromise<ValueType>[]):TPromise<{ key:string; value:TPromise<ValueType>;}>;
public static wrap<ValueType>(value: Thenable<ValueType>): TPromise<ValueType>;
public static wrap<ValueType>(value: ValueType): TPromise<ValueType>;
public static wrapError<ValueType>(error:any):TPromise<ValueType>;
}
......
......@@ -29,7 +29,7 @@ export class ExtHostQuickOpen extends ExtHostQuickOpenShape {
// clear state from last invocation
this._onDidSelectItem = undefined;
const itemsPromise = <TPromise<Item[]>> TPromise.as(itemsOrItemsPromise);
const itemsPromise = <TPromise<Item[]>>TPromise.wrap(itemsOrItemsPromise);
const quickPickWidget = this._proxy.$show({
autoFocus: { autoFocusFirstEntry: true },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册