Skip to content

Commit 3c9fd5c

Browse files
committed
Move getSessionFilePath to SessionManager class
1 parent cca8f6f commit 3c9fd5c

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

src/features/DebugSession.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ export class DebugSessionFeature extends LanguageClientConsumer
311311
// Create or show the interactive console
312312
vscode.commands.executeCommand("PowerShell.ShowSessionConsole", true);
313313

314-
const sessionFilePath = utils.getDebugSessionFilePath();
314+
const sessionFilePath = this.sessionManager.getDebugSessionFilePath();
315315

316316
if (config.createTemporaryIntegratedConsole) {
317317
// TODO: This should be cleaned up to support multiple temporary consoles.

src/features/PesterTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export class PesterTestsFeature implements vscode.Disposable {
132132

133133
// Write out temporary debug session file
134134
await utils.writeSessionFile(
135-
utils.getDebugSessionFilePath(),
135+
this.sessionManager.getDebugSessionFilePath(),
136136
this.sessionManager.getSessionDetails());
137137

138138
// TODO: Update to handle multiple root workspaces.

src/features/RunCode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class RunCodeFeature implements vscode.Disposable {
4545

4646
// Write out temporary debug session file
4747
await utils.writeSessionFile(
48-
utils.getDebugSessionFilePath(),
48+
this.sessionManager.getDebugSessionFilePath(),
4949
this.sessionManager.getSessionDetails());
5050

5151
// TODO: Update to handle multiple root workspaces.

src/session.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export class SessionManager implements Middleware {
5656
private languageServerClient: LanguageClient = undefined;
5757
private sessionSettings: Settings.ISettings = undefined;
5858
private sessionDetails: utils.IEditorServicesSessionDetails;
59+
private sessionsFolder = path.resolve(__dirname, "../sessions");
60+
private sessionFilePathPrefix = path.resolve(this.sessionsFolder, "PSES-VSCode-" + process.env.VSCODE_PID);
5961
private bundledModulesPath: string;
6062
private started: boolean = false;
6163

@@ -259,6 +261,14 @@ export class SessionManager implements Middleware {
259261
return this.versionDetails;
260262
}
261263

264+
private getSessionFilePath(uniqueId: number): string {
265+
return `${this.sessionFilePathPrefix}-${uniqueId}`;
266+
}
267+
268+
public getDebugSessionFilePath(): string {
269+
return `${this.sessionFilePathPrefix}-Debug`;
270+
}
271+
262272
public createDebugSessionProcess(
263273
sessionPath: string,
264274
sessionSettings: Settings.ISettings): PowerShellProcess {
@@ -446,7 +456,7 @@ export class SessionManager implements Middleware {
446456
this.setSessionStatus("Starting...", SessionStatus.Initializing);
447457

448458
const sessionFilePath =
449-
utils.getSessionFilePath(
459+
this.getSessionFilePath(
450460
Math.floor(100000 + Math.random() * 900000));
451461

452462
this.languageServerProcess =

src/utils.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ export interface IEditorServicesSessionDetails {
5252
export type IReadSessionFileCallback = (details: IEditorServicesSessionDetails) => void;
5353

5454
const sessionsFolder = path.resolve(__dirname, "../sessions");
55-
const sessionFilePathPrefix = path.resolve(sessionsFolder, "PSES-VSCode-" + process.env.VSCODE_PID);
56-
57-
export function getSessionFilePath(uniqueId: number) {
58-
return `${sessionFilePathPrefix}-${uniqueId}`;
59-
}
60-
61-
export function getDebugSessionFilePath() {
62-
return `${sessionFilePathPrefix}-Debug`;
63-
}
6455

6556
export async function writeSessionFile(sessionFilePath: string, sessionDetails: IEditorServicesSessionDetails) {
6657
await vscode.workspace.fs.createDirectory(vscode.Uri.file(sessionsFolder));

0 commit comments

Comments
 (0)