@@ -78,10 +78,6 @@ interface IReconnectionTaskData {
78
78
group ?: string ;
79
79
}
80
80
81
- interface IReconnectedTerminal extends ITerminalInstance {
82
- reconnectionData : IReconnectionTaskData ;
83
- }
84
-
85
81
const ReconnectionType = 'Task' ;
86
82
87
83
class VariableResolver {
@@ -202,7 +198,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
202
198
private _terminalCreationQueue : Promise < ITerminalInstance | void > = Promise . resolve ( ) ;
203
199
private _hasReconnected : boolean = false ;
204
200
private readonly _onDidStateChange : Emitter < ITaskEvent > ;
205
- private _reconnectedTerminals : IReconnectedTerminal [ ] | undefined ;
201
+ private _reconnectedTerminals : ITerminalInstance [ ] | undefined ;
206
202
207
203
taskShellIntegrationStartSequence ( cwd : string | URI | undefined ) : string {
208
204
return (
@@ -1281,7 +1277,8 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
1281
1277
}
1282
1278
for ( let i = 0 ; i < this . _reconnectedTerminals . length ; i ++ ) {
1283
1279
const terminal = this . _reconnectedTerminals [ i ] ;
1284
- if ( terminal . reconnectionData . lastTask === task . getCommonTaskId ( ) ) {
1280
+ const data = terminal . shellLaunchConfig ?. attachPersistentProcess ?. reconnectionProperties ?. data as IReconnectionTaskData | undefined ;
1281
+ if ( data ?. lastTask === task . getCommonTaskId ( ) ) {
1285
1282
this . _reconnectedTerminals . splice ( i , 1 ) ;
1286
1283
return terminal ;
1287
1284
}
@@ -1327,21 +1324,17 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
1327
1324
return ;
1328
1325
}
1329
1326
this . _reconnectedTerminals = [ ] ;
1330
- for ( const terminal of this . _terminalService . getReconnectedTerminals ( ReconnectionType ) ?. filter ( t => ! t . isDisposed ) || [ ] ) {
1331
- const reconnectionData = terminal . shellLaunchConfig . attachPersistentProcess ?. reconnectionProperties ?. data as IReconnectionTaskData ;
1332
- if ( reconnectionData ) {
1333
- this . _reconnectedTerminals . push ( { ...terminal , reconnectionData } ) ;
1334
- } else {
1335
- this . _logService . trace ( `Terminal was owned by tasks but has no reconnection data` , terminal . instanceId , terminal . shellLaunchConfig ) ;
1336
- }
1337
- }
1327
+ this . _reconnectedTerminals = this . _terminalService . getReconnectedTerminals ( ReconnectionType ) ?. filter ( t => ! t . isDisposed && t . shellLaunchConfig . attachPersistentProcess ?. reconnectionProperties ?. data ) || [ ] ;
1338
1328
this . _logService . trace ( `Attempting reconnection of ${ this . _reconnectedTerminals ?. length } terminals` ) ;
1339
1329
if ( ! this . _reconnectedTerminals ?. length ) {
1340
1330
this . _logService . trace ( `No terminals to reconnect to so returning` ) ;
1341
1331
} else {
1342
1332
for ( const terminal of this . _reconnectedTerminals ) {
1343
- const terminalData = { lastTask : terminal . reconnectionData . lastTask , group : terminal . reconnectionData . group , terminal } ;
1344
- this . _terminals [ terminal . instanceId ] = terminalData ;
1333
+ const data = terminal . shellLaunchConfig ?. attachPersistentProcess ?. reconnectionProperties ?. data as IReconnectionTaskData | undefined ;
1334
+ if ( data ) {
1335
+ const terminalData = { lastTask : data . lastTask , group : data . group , terminal } ;
1336
+ this . _terminals [ terminal . instanceId ] = terminalData ;
1337
+ }
1345
1338
}
1346
1339
}
1347
1340
this . _hasReconnected = true ;
0 commit comments