Skip to content

Commit 9843d07

Browse files
authored
don't activate task providers on request to reconnect tasks (microsoft#159090)
fix microsoft#155740
1 parent e197a11 commit 9843d07

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,16 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
330330
this._waitForSupportedExecutions = new Promise(resolve => {
331331
once(this._onDidRegisterSupportedExecutions.event)(() => resolve());
332332
});
333-
if (this._terminalService.getReconnectedTerminals('Task')) {
333+
if (this._terminalService.getReconnectedTerminals('Task')?.length) {
334334
this._attemptTaskReconnection();
335335
} else {
336-
this._register(this._terminalService.onDidChangeConnectionState(() => this._attemptTaskReconnection()));
336+
this._register(this._terminalService.onDidChangeConnectionState(() => {
337+
if (this._terminalService.getReconnectedTerminals('Task')?.length) {
338+
this._attemptTaskReconnection();
339+
}
340+
}));
337341
}
342+
338343
this._upgrade();
339344
}
340345

@@ -356,25 +361,23 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
356361
}
357362

358363
private _attemptTaskReconnection(): void {
364+
if (this._lifecycleService.startupKind !== StartupKind.ReloadedWindow) {
365+
this._tasksReconnected = true;
366+
this._storageService.remove(AbstractTaskService.PersistentTasks_Key, StorageScope.WORKSPACE);
367+
}
368+
if (!this._configurationService.getValue(TaskSettingId.Reconnection) || this._tasksReconnected) {
369+
this._tasksReconnected = true;
370+
return;
371+
}
359372
this._getTaskSystem();
360373
this._waitForSupportedExecutions.then(() => {
361-
this._activateTaskProviders(undefined).then(() => {
362-
this.getWorkspaceTasks().then(async () => {
363-
if (this._configurationService.getValue(TaskSettingId.Reconnection) === true && !this._tasksReconnected) {
364-
await this._reconnectTasks();
365-
}
366-
});
374+
this.getWorkspaceTasks().then(async () => {
375+
this._tasksReconnected = await this._reconnectTasks();
367376
});
368377
});
369378
}
370379

371380
private async _reconnectTasks(): Promise<boolean> {
372-
if (this._lifecycleService.startupKind !== StartupKind.ReloadedWindow) {
373-
this._tasksReconnected = true;
374-
this._storageService.remove(AbstractTaskService.PersistentTasks_Key, StorageScope.WORKSPACE);
375-
return true;
376-
}
377-
378381
const tasks = await this.getSavedTasks('persistent');
379382
if (!tasks.length) {
380383
return true;

0 commit comments

Comments
 (0)