@@ -85,11 +85,13 @@ export class SessionManager implements Middleware {
8585 version : string ,
8686 private telemetryReporter : TelemetryReporter ) {
8787
88+ // Create a folder for the session files.
8889 if ( extensionContext . storageUri !== undefined ) {
8990 this . sessionsFolder = vscode . Uri . joinPath ( extensionContext . storageUri , "sessions" ) ;
9091 } else {
9192 this . sessionsFolder = vscode . Uri . file ( path . resolve ( __dirname , "../sessions" ) ) ;
9293 }
94+ vscode . workspace . fs . createDirectory ( this . sessionsFolder ) ;
9395
9496 this . platformDetails = getPlatformDetails ( ) ;
9597
@@ -285,14 +287,6 @@ export class SessionManager implements Middleware {
285287 return vscode . Uri . joinPath ( this . sessionsFolder , "PSES-VSCode-" + process . env . VSCODE_PID + "-" + uniqueId + ".json" ) ;
286288 }
287289
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-
296290 public static readSessionFile ( sessionFilePath : vscode . Uri ) : IEditorServicesSessionDetails {
297291 // TODO: Use vscode.workspace.fs.readFile instead of fs.readFileSync.
298292 const fileContents = fs . readFileSync ( sessionFilePath . fsPath , "utf-8" ) ;
@@ -307,9 +301,7 @@ export class SessionManager implements Middleware {
307301 }
308302 }
309303
310- public createDebugSessionProcess (
311- sessionPath : vscode . Uri ,
312- sessionSettings : Settings . ISettings ) : PowerShellProcess {
304+ public createDebugSessionProcess ( sessionSettings : Settings . ISettings ) : PowerShellProcess {
313305
314306 // NOTE: We only support one temporary integrated console at a time. To
315307 // support more, we need to track each separately, and tie the session
@@ -327,7 +319,7 @@ export class SessionManager implements Middleware {
327319 "[TEMP] PowerShell Integrated Console" ,
328320 this . log ,
329321 this . editorServicesArgs + "-DebugServiceOnly " ,
330- sessionPath ,
322+ this . getNewSessionFilePath ( ) ,
331323 sessionSettings ) ;
332324
333325 // Similar to the regular integrated console, we need to send a key
@@ -493,16 +485,14 @@ export class SessionManager implements Middleware {
493485 private startPowerShell ( ) {
494486 this . setSessionStatus ( "Starting..." , SessionStatus . Initializing ) ;
495487
496- const sessionFilePath = this . getNewSessionFilePath ( ) ;
497-
498488 this . languageServerProcess =
499489 new PowerShellProcess (
500490 this . PowerShellExeDetails . exePath ,
501491 this . bundledModulesPath ,
502492 "PowerShell Integrated Console" ,
503493 this . log ,
504494 this . editorServicesArgs ,
505- sessionFilePath ,
495+ this . getNewSessionFilePath ( ) ,
506496 this . sessionSettings ) ;
507497
508498 this . languageServerProcess . onExited (
0 commit comments