mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-20 10:29:36 -06:00
MultistepOperation: Don't need 'completed', just use requestId === undefined (#17173)
* MultistepOperation: Don't need 'completed', just use `requestId === undefined` * Check for `requestId !== undefined`
This commit is contained in:
parent
ceae613e4c
commit
e1802f4966
@ -163,26 +163,22 @@ namespace ts.server {
|
||||
* Scheduling is done via instance of NextStep. If on current step subsequent step was not scheduled - operation is assumed to be completed.
|
||||
*/
|
||||
class MultistepOperation implements NextStep {
|
||||
private requestId: number;
|
||||
private requestId: number | undefined;
|
||||
private timerHandle: any;
|
||||
private immediateId: any;
|
||||
private completed = true;
|
||||
private immediateId: number | undefined;
|
||||
|
||||
constructor(private readonly operationHost: MultistepOperationHost) {}
|
||||
|
||||
public startNew(action: (next: NextStep) => void) {
|
||||
this.complete();
|
||||
this.requestId = this.operationHost.getCurrentRequestId();
|
||||
this.completed = false;
|
||||
this.executeAction(action);
|
||||
}
|
||||
|
||||
private complete() {
|
||||
if (!this.completed) {
|
||||
if (this.requestId) {
|
||||
this.operationHost.sendRequestCompletedEvent(this.requestId);
|
||||
}
|
||||
this.completed = true;
|
||||
if (this.requestId !== undefined) {
|
||||
this.operationHost.sendRequestCompletedEvent(this.requestId);
|
||||
this.requestId = undefined;
|
||||
}
|
||||
this.setTimerHandle(undefined);
|
||||
this.setImmediateId(undefined);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user