@@ -85,11 +85,13 @@ export class SessionManager implements Middleware {
85
85
version : string ,
86
86
private telemetryReporter : TelemetryReporter ) {
87
87
88
+ // Create a folder for the session files.
88
89
if ( extensionContext . storageUri !== undefined ) {
89
90
this . sessionsFolder = vscode . Uri . joinPath ( extensionContext . storageUri , "sessions" ) ;
90
91
} else {
91
92
this . sessionsFolder = vscode . Uri . file ( path . resolve ( __dirname , "../sessions" ) ) ;
92
93
}
94
+ vscode . workspace . fs . createDirectory ( this . sessionsFolder ) ;
93
95
94
96
this . platformDetails = getPlatformDetails ( ) ;
95
97
@@ -285,14 +287,6 @@ export class SessionManager implements Middleware {
285
287
return vscode . Uri . joinPath ( this . sessionsFolder , "PSES-VSCode-" + process . env . VSCODE_PID + "-" + uniqueId + ".json" ) ;
286
288
}
287
289
288
- public async writeSessionFile ( sessionFilePath : vscode . Uri , sessionDetails : IEditorServicesSessionDetails ) {
289
- await vscode . workspace . fs . createDirectory ( this . sessionsFolder ) ;
290
-
291
- const writeStream = fs . createWriteStream ( sessionFilePath . fsPath ) ;
292
- writeStream . write ( JSON . stringify ( sessionDetails ) ) ;
293
- writeStream . close ( ) ;
294
- }
295
-
296
290
public static readSessionFile ( sessionFilePath : vscode . Uri ) : IEditorServicesSessionDetails {
297
291
// TODO: Use vscode.workspace.fs.readFile instead of fs.readFileSync.
298
292
const fileContents = fs . readFileSync ( sessionFilePath . fsPath , "utf-8" ) ;
@@ -307,9 +301,7 @@ export class SessionManager implements Middleware {
307
301
}
308
302
}
309
303
310
- public createDebugSessionProcess (
311
- sessionPath : vscode . Uri ,
312
- sessionSettings : Settings . ISettings ) : PowerShellProcess {
304
+ public createDebugSessionProcess ( sessionSettings : Settings . ISettings ) : PowerShellProcess {
313
305
314
306
// NOTE: We only support one temporary integrated console at a time. To
315
307
// support more, we need to track each separately, and tie the session
@@ -327,7 +319,7 @@ export class SessionManager implements Middleware {
327
319
"[TEMP] PowerShell Integrated Console" ,
328
320
this . log ,
329
321
this . editorServicesArgs + "-DebugServiceOnly " ,
330
- sessionPath ,
322
+ this . getNewSessionFilePath ( ) ,
331
323
sessionSettings ) ;
332
324
333
325
// Similar to the regular integrated console, we need to send a key
@@ -493,16 +485,14 @@ export class SessionManager implements Middleware {
493
485
private startPowerShell ( ) {
494
486
this . setSessionStatus ( "Starting..." , SessionStatus . Initializing ) ;
495
487
496
- const sessionFilePath = this . getNewSessionFilePath ( ) ;
497
-
498
488
this . languageServerProcess =
499
489
new PowerShellProcess (
500
490
this . PowerShellExeDetails . exePath ,
501
491
this . bundledModulesPath ,
502
492
"PowerShell Integrated Console" ,
503
493
this . log ,
504
494
this . editorServicesArgs ,
505
- sessionFilePath ,
495
+ this . getNewSessionFilePath ( ) ,
506
496
this . sessionSettings ) ;
507
497
508
498
this . languageServerProcess . onExited (
0 commit comments