Skip to content

VS Code doesn't call shutdown when exiting the standard client #2472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 13 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,9 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {

apiManager.getApiInstance().onDidServerModeChange((event: ServerMode) => {
if (event === ServerMode.STANDARD) {
syntaxClient.stop();
syntaxClient.getClient().stop().then(client => {
syntaxClient.stop();
});
fileEventHandler.setServerStatus(true);
runtimeStatusBarProvider.initialize(context);
}
Expand Down Expand Up @@ -633,9 +635,16 @@ export function getJavaConfig(javaHome: string) {
return javaConfig;
}

export function deactivate(): void {
standardClient.stop();
syntaxClient.stop();
export function deactivate(): Promise<void> {
return getActiveLanguageClient().then(client => {
standardClient.stop();
syntaxClient.stop();
if (!client) {
return undefined;
} else {
return client.stop();
}
});
}

export async function getActiveLanguageClient(): Promise<LanguageClient | undefined> {
Expand Down
1 change: 0 additions & 1 deletion src/standardLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ export class StandardLanguageClient {

public stop() {
if (this.languageClient) {
this.languageClient.stop();
this.status = ClientStatus.Stopping;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/syntaxLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export class SyntaxLanguageClient {
public stop() {
this.status = ClientStatus.Stopping;
if (this.languageClient) {
this.languageClient.stop();
this.languageClient = null;
}
}
Expand Down