Remove WinJS.Promise#cancel usage (#56137)

This commit is contained in:
Christof Marti
2018-09-06 14:56:22 +02:00
parent 5ecddfec9c
commit 554c9b1460
3 changed files with 14 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { wireCancellationToken, asThenable } from 'vs/base/common/async';
import { asThenable } from 'vs/base/common/async';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Emitter } from 'vs/base/common/event';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
@@ -130,8 +130,16 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
// global validate fn used in callback below
this._validateInput = options && options.validateInput;
const promise = this._proxy.$input(options, typeof this._validateInput === 'function');
return wireCancellationToken(token, promise, true);
return this._proxy.$input(options, typeof this._validateInput === 'function', token)
.then(null, err => {
if (isPromiseCanceledError(err)) {
return undefined;
}
this._proxy.$setError(err);
return TPromise.wrapError(err);
});
}
$validateInput(input: string): Thenable<string> {