Skip to content

Commit e1802f4

Browse files
author
Andy
authored
MultistepOperation: Don't need 'completed', just use requestId === undefined (#17173)
* MultistepOperation: Don't need 'completed', just use `requestId === undefined` * Check for `requestId !== undefined`
1 parent ceae613 commit e1802f4

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/server/session.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,26 +163,22 @@ namespace ts.server {
163163
* Scheduling is done via instance of NextStep. If on current step subsequent step was not scheduled - operation is assumed to be completed.
164164
*/
165165
class MultistepOperation implements NextStep {
166-
private requestId: number;
166+
private requestId: number | undefined;
167167
private timerHandle: any;
168-
private immediateId: any;
169-
private completed = true;
168+
private immediateId: number | undefined;
170169

171170
constructor(private readonly operationHost: MultistepOperationHost) {}
172171

173172
public startNew(action: (next: NextStep) => void) {
174173
this.complete();
175174
this.requestId = this.operationHost.getCurrentRequestId();
176-
this.completed = false;
177175
this.executeAction(action);
178176
}
179177

180178
private complete() {
181-
if (!this.completed) {
182-
if (this.requestId) {
183-
this.operationHost.sendRequestCompletedEvent(this.requestId);
184-
}
185-
this.completed = true;
179+
if (this.requestId !== undefined) {
180+
this.operationHost.sendRequestCompletedEvent(this.requestId);
181+
this.requestId = undefined;
186182
}
187183
this.setTimerHandle(undefined);
188184
this.setImmediateId(undefined);

0 commit comments

Comments
 (0)