Skip to content

Commit 143da24

Browse files
committed
add log and helper function
1 parent e4bb341 commit 143da24

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,8 +1277,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
12771277
}
12781278
for (let i = 0; i < this._reconnectedTerminals.length; i++) {
12791279
const terminal = this._reconnectedTerminals[i];
1280-
const data = terminal.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties?.data as IReconnectionTaskData | undefined;
1281-
if (data?.lastTask === task.getCommonTaskId()) {
1280+
if (getReconnectionData(terminal)?.lastTask === task.getCommonTaskId()) {
12821281
this._reconnectedTerminals.splice(i, 1);
12831282
return terminal;
12841283
}
@@ -1323,16 +1322,17 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
13231322
this._logService.trace(`Already reconnected, to ${this._reconnectedTerminals?.length} terminals so returning`);
13241323
return;
13251324
}
1326-
this._reconnectedTerminals = this._terminalService.getReconnectedTerminals(ReconnectionType)?.filter(t => !t.isDisposed && t.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties?.data) || [];
1325+
this._reconnectedTerminals = this._terminalService.getReconnectedTerminals(ReconnectionType)?.filter(t => !t.isDisposed && getReconnectionData(t)) || [];
13271326
this._logService.trace(`Attempting reconnection of ${this._reconnectedTerminals?.length} terminals`);
13281327
if (!this._reconnectedTerminals?.length) {
13291328
this._logService.trace(`No terminals to reconnect to so returning`);
13301329
} else {
13311330
for (const terminal of this._reconnectedTerminals) {
1332-
const data = terminal.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties?.data as IReconnectionTaskData | undefined;
1331+
const data = getReconnectionData(terminal) as IReconnectionTaskData | undefined;
13331332
if (data) {
13341333
const terminalData = { lastTask: data.lastTask, group: data.group, terminal };
13351334
this._terminals[terminal.instanceId] = terminalData;
1335+
this._logService.trace('Reconnecting to task terminal', terminalData.lastTask, terminal.instanceId);
13361336
}
13371337
}
13381338
}
@@ -1837,3 +1837,7 @@ function taskShellIntegrationWaitOnExitSequence(message: string): (exitCode: num
18371837
return `${VSCodeSequence(VSCodeOscPt.CommandFinished, exitCode.toString())}${message}`;
18381838
};
18391839
}
1840+
1841+
function getReconnectionData(terminal: ITerminalInstance): IReconnectionTaskData | undefined {
1842+
return terminal.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties?.data as IReconnectionTaskData | undefined;
1843+
}

0 commit comments

Comments
 (0)