Skip to content

Commit

Permalink
Merge branch 'main' into justingrote/feature/languageClient-trace
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinGrote authored Jan 25, 2024
2 parents 8748457 + 6d897c8 commit c2ea6d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class PowerShellProcess {
private static warnUserThreshold = 30;

public onExited: vscode.Event<void>;
private onExitedEmitter = new vscode.EventEmitter<void>();
private onExitedEmitter?: vscode.EventEmitter<void>;

private consoleTerminal?: vscode.Terminal;
private consoleCloseSubscription?: vscode.Disposable;
Expand All @@ -31,6 +31,7 @@ export class PowerShellProcess {
private sessionFilePath: vscode.Uri,
private sessionSettings: Settings) {

this.onExitedEmitter = new vscode.EventEmitter<void>();
this.onExited = this.onExitedEmitter.event;
}

Expand Down Expand Up @@ -149,6 +150,9 @@ export class PowerShellProcess {

void this.deleteSessionFile(this.sessionFilePath);

this.onExitedEmitter?.fire();
this.onExitedEmitter = undefined;

this.consoleTerminal?.dispose();
this.consoleTerminal = undefined;

Expand Down Expand Up @@ -230,7 +234,6 @@ export class PowerShellProcess {
}

this.logger.writeWarning(`PowerShell process terminated or Extension Terminal was closed, PID: ${this.pid}`);
this.onExitedEmitter.fire();
this.dispose();
}
}
4 changes: 2 additions & 2 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,13 @@ export class SessionManager implements Middleware {
this.sessionSettings);

languageServerProcess.onExited(
async () => {
() => {
LanguageClientConsumer.onLanguageClientExited();

if (this.sessionStatus === SessionStatus.Running
|| this.sessionStatus === SessionStatus.Busy) {
this.setSessionStatus("Session Exited!", SessionStatus.Failed);
await this.promptForRestart();
void this.promptForRestart();
}
});

Expand Down

0 comments on commit c2ea6d7

Please sign in to comment.