Skip to content

Commit e433e7c

Browse files
committed
remove empty cancel callback from promise constructions microsoft#56137
1 parent 8ad3bcf commit e433e7c

8 files changed

Lines changed: 12 additions & 20 deletions

File tree

src/vs/base/common/async.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function asThenable<T>(callback: () => T | TPromise<T> | Thenable<T>): Th
6868
} else {
6969
resolve(item);
7070
}
71-
}, () => { /* not supported */ });
71+
});
7272
}
7373

7474
export interface ITask<T> {
@@ -136,8 +136,6 @@ export class Throttler {
136136

137137
return new TPromise((c, e) => {
138138
this.queuedPromise.then(c, e);
139-
}, () => {
140-
// no-op
141139
});
142140
}
143141

@@ -287,8 +285,6 @@ export class Barrier {
287285
this._isOpen = false;
288286
this._promise = new TPromise<boolean>((c, e) => {
289287
this._completePromise = c;
290-
}, () => {
291-
console.warn('You should really not try to cancel this ready promise!');
292288
});
293289
}
294290

@@ -712,11 +708,11 @@ export class RunOnceWorker<T> extends RunOnceScheduler {
712708
export function nfcall(fn: Function, ...args: any[]): TPromise;
713709
export function nfcall<T>(fn: Function, ...args: any[]): TPromise<T>;
714710
export function nfcall(fn: Function, ...args: any[]): any {
715-
return new TPromise((c, e) => fn(...args, (err: any, result: any) => err ? e(err) : c(result)), () => null);
711+
return new TPromise((c, e) => fn(...args, (err: any, result: any) => err ? e(err) : c(result)));
716712
}
717713

718714
export function ninvoke(thisArg: any, fn: Function, ...args: any[]): TPromise;
719715
export function ninvoke<T>(thisArg: any, fn: Function, ...args: any[]): TPromise<T>;
720716
export function ninvoke(thisArg: any, fn: Function, ...args: any[]): any {
721-
return new TPromise((c, e) => fn.call(thisArg, ...args, (err: any, result: any) => err ? e(err) : c(result)), () => null);
717+
return new TPromise((c, e) => fn.call(thisArg, ...args, (err: any, result: any) => err ? e(err) : c(result)));
722718
}

src/vs/base/common/worker/simpleWorker.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ class SimpleWorkerProtocol {
9494
let result = new TPromise<any>((c, e) => {
9595
reply.c = c;
9696
reply.e = e;
97-
}, () => {
98-
// Cancel not supported
9997
});
10098
this._pendingReplies[req] = reply;
10199

@@ -235,7 +233,7 @@ export class SimpleWorkerClient<T> extends Disposable {
235233
this._lazyProxy = new TPromise<T>((c, e) => {
236234
lazyProxyFulfill = c;
237235
lazyProxyReject = e;
238-
}, () => { /* no cancel */ });
236+
});
239237

240238
// Send initialize message
241239
this._onModuleLoaded = this._protocol.sendMessage(INITIALIZE, [
@@ -277,8 +275,6 @@ export class SimpleWorkerClient<T> extends Disposable {
277275
this._onModuleLoaded.then(() => {
278276
this._protocol.sendMessage(method, args).then(c, e);
279277
}, e);
280-
}, () => {
281-
// Cancel intentionally not supported
282278
});
283279
}
284280

src/vs/base/node/pfs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function readdir(path: string): TPromise<string[]> {
1919
}
2020

2121
export function exists(path: string): TPromise<boolean> {
22-
return new TPromise(c => fs.exists(path, c), () => { });
22+
return new TPromise(c => fs.exists(path, c));
2323
}
2424

2525
export function chmod(path: string, mode: number): TPromise<boolean> {
@@ -194,4 +194,4 @@ export function whenDeleted(path: string): TPromise<void> {
194194

195195
export function copy(source: string, target: string): TPromise<void> {
196196
return nfcall(extfs.copy, source, target);
197-
}
197+
}

src/vs/platform/extensionManagement/node/extensionManagementService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
885885
}
886886

887887
private toNonCancellablePromise<T>(promise: TPromise<T>): TPromise<T> {
888-
return new TPromise((c, e) => promise.then(result => c(result), error => e(error)), () => this.logService.debug('Request Cancelled'));
888+
return new TPromise((c, e) => promise.then(result => c(result), error => e(error)));
889889
}
890890

891891
private reportTelemetry(eventName: string, extensionData: any, duration: number, error?: Error): void {

src/vs/workbench/parts/debug/node/terminals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function getDefaultTerminalLinuxReady(): TPromise<string> {
5555
}
5656

5757
c('xterm');
58-
}, () => { });
58+
});
5959
}
6060
return _DEFAULT_TERMINAL_LINUX_READY;
6161
}

src/vs/workbench/parts/execution/electron-browser/terminal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function getDefaultTerminalLinuxReady(): TPromise<string> {
3232
}
3333

3434
c('xterm');
35-
}, () => { });
35+
});
3636
}
3737
return _DEFAULT_TERMINAL_LINUX_READY;
3838
}

src/vs/workbench/parts/tasks/common/problemMatcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ class ProblemPatternRegistryImpl implements IProblemPatternRegistry {
10881088
}
10891089
resolve(undefined);
10901090
});
1091-
}, () => { });
1091+
});
10921092
}
10931093

10941094
public onReady(): TPromise<void> {
@@ -1642,7 +1642,7 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
16421642
}
16431643
resolve(undefined);
16441644
});
1645-
}, () => { });
1645+
});
16461646
}
16471647

16481648
public onReady(): TPromise<void> {

src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class TaskDefinitionRegistryImpl implements ITaskDefinitionRegistry {
107107
}
108108
resolve(undefined);
109109
});
110-
}, () => { });
110+
});
111111
}
112112

113113
public onReady(): TPromise<void> {

0 commit comments

Comments
 (0)