Skip to content

Commit 842a93c

Browse files
committed
Remove writeSessionFile as only the server writes it
No idea why we were writing it as the client. Maybe I've totally misunderstood, but everything works as expected without this (and moreover, we delete any existing session file and then wait for it, after passing the path to the server).
1 parent 8d10aa3 commit 842a93c

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

src/features/DebugSession.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,9 @@ export class DebugSessionFeature extends LanguageClientConsumer
309309
// Create or show the interactive console
310310
vscode.commands.executeCommand("PowerShell.ShowSessionConsole", true);
311311

312-
const sessionFilePath = this.sessionManager.getNewSessionFilePath();
313-
314312
if (config.createTemporaryIntegratedConsole) {
315-
this.tempDebugProcess = this.sessionManager.createDebugSessionProcess(sessionFilePath, settings);
313+
this.tempDebugProcess = this.sessionManager.createDebugSessionProcess(settings);
316314
this.tempSessionDetails = await this.tempDebugProcess.start(`DebugSession-${this.sessionCount++}`);
317-
await this.sessionManager.writeSessionFile(sessionFilePath, this.tempSessionDetails);
318-
} else {
319-
await this.sessionManager.writeSessionFile(sessionFilePath, this.sessionManager.getSessionDetails());
320315
}
321316

322317
return config;

src/session.ts

+3-15
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,6 @@ export class SessionManager implements Middleware {
285285
return vscode.Uri.joinPath(this.sessionsFolder, "PSES-VSCode-" + process.env.VSCODE_PID + "-" + uniqueId + ".json");
286286
}
287287

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-
296288
public static readSessionFile(sessionFilePath: vscode.Uri): IEditorServicesSessionDetails {
297289
// TODO: Use vscode.workspace.fs.readFile instead of fs.readFileSync.
298290
const fileContents = fs.readFileSync(sessionFilePath.fsPath, "utf-8");
@@ -307,9 +299,7 @@ export class SessionManager implements Middleware {
307299
}
308300
}
309301

310-
public createDebugSessionProcess(
311-
sessionPath: vscode.Uri,
312-
sessionSettings: Settings.ISettings): PowerShellProcess {
302+
public createDebugSessionProcess(sessionSettings: Settings.ISettings): PowerShellProcess {
313303

314304
// NOTE: We only support one temporary integrated console at a time. To
315305
// support more, we need to track each separately, and tie the session
@@ -327,7 +317,7 @@ export class SessionManager implements Middleware {
327317
"[TEMP] PowerShell Integrated Console",
328318
this.log,
329319
this.editorServicesArgs + "-DebugServiceOnly ",
330-
sessionPath,
320+
this.getNewSessionFilePath(),
331321
sessionSettings);
332322

333323
// Similar to the regular integrated console, we need to send a key
@@ -493,16 +483,14 @@ export class SessionManager implements Middleware {
493483
private startPowerShell() {
494484
this.setSessionStatus("Starting...", SessionStatus.Initializing);
495485

496-
const sessionFilePath = this.getNewSessionFilePath();
497-
498486
this.languageServerProcess =
499487
new PowerShellProcess(
500488
this.PowerShellExeDetails.exePath,
501489
this.bundledModulesPath,
502490
"PowerShell Integrated Console",
503491
this.log,
504492
this.editorServicesArgs,
505-
sessionFilePath,
493+
this.getNewSessionFilePath(),
506494
this.sessionSettings);
507495

508496
this.languageServerProcess.onExited(

0 commit comments

Comments
 (0)