mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
Use ?. in a few more places
This commit is contained in:
parent
c3a004ea9b
commit
90b50dc7e2
|
@ -8,9 +8,7 @@ import * as vscode from 'vscode';
|
|||
export function disposeAll(disposables: vscode.Disposable[]) {
|
||||
while (disposables.length) {
|
||||
const item = disposables.pop();
|
||||
if (item) {
|
||||
item.dispose();
|
||||
}
|
||||
item?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,4 +37,4 @@ export abstract class Disposable {
|
|||
protected get isDisposed() {
|
||||
return this._isDisposed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,7 @@ import * as vscode from 'vscode';
|
|||
export function disposeAll(disposables: vscode.Disposable[]) {
|
||||
while (disposables.length) {
|
||||
const item = disposables.pop();
|
||||
if (item) {
|
||||
item.dispose();
|
||||
}
|
||||
item?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -186,9 +186,7 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe
|
|||
return false;
|
||||
} finally {
|
||||
const callback = this.fetchCallback(seq);
|
||||
if (callback) {
|
||||
callback.onSuccess(new ServerResponse.Cancelled(`Cancelled request ${seq} - ${command}`));
|
||||
}
|
||||
callback?.onSuccess(new ServerResponse.Cancelled(`Cancelled request ${seq} - ${command}`));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,9 +271,7 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe
|
|||
this.write(serverRequest);
|
||||
} catch (err) {
|
||||
const callback = this.fetchCallback(serverRequest.seq);
|
||||
if (callback) {
|
||||
callback.onError(err);
|
||||
}
|
||||
callback?.onError(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,9 +46,7 @@ export class Delayer<T> {
|
|||
if (delay >= 0 || this.timeout === null) {
|
||||
this.timeout = setTimeout(() => {
|
||||
this.timeout = null;
|
||||
if (this.onSuccess) {
|
||||
this.onSuccess(undefined);
|
||||
}
|
||||
this.onSuccess?.(undefined);
|
||||
}, delay >= 0 ? delay : this.defaultDelay);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,7 @@ import * as vscode from 'vscode';
|
|||
export function disposeAll(disposables: vscode.Disposable[]) {
|
||||
while (disposables.length) {
|
||||
const item = disposables.pop();
|
||||
if (item) {
|
||||
item.dispose();
|
||||
}
|
||||
item?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,4 +37,4 @@ export abstract class Disposable {
|
|||
protected get isDisposed() {
|
||||
return this._isDisposed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue