Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/ansible-language-server/src/ansibleLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class AnsibleLanguageService {
public initialize(): void {
this.initializeConnection();
this.registerLifecycleEventHandlers();
this.registerShutdownHandler();
}

private initializeConnection() {
Expand Down Expand Up @@ -364,6 +365,15 @@ export class AnsibleLanguageService {
);
}

private registerShutdownHandler() {
this.connection.onShutdown(async () => {
// Dispose all persistent EE containers on language server shutdown
await this.workspaceManager.forEachContext(async (context) => {
await context.disposeExecutionEnvironment();
});
});
}

private handleError(error: unknown, contextName: string) {
const leadMessage = `An error occurred in '${contextName}' handler: `;
if (error instanceof Error) {
Expand Down
Loading
Loading