Skip to content

Commit 05f7f7c

Browse files
edvilmeCopilotCopilot
authored
Sync with template: Fix duplicate server handlers on concurrent restarts (#637)
Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c7ad99b commit 05f7f7c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/common/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ export async function restartServer(
8888
} catch (ex) {
8989
traceError(`Server: Stop failed: ${ex}`);
9090
}
91-
_disposables.forEach((d) => d.dispose());
92-
_disposables = [];
9391
}
92+
_disposables.forEach((d) => d.dispose());
93+
_disposables = [];
9494
updateStatus(undefined, LanguageStatusSeverity.Information, true);
9595

9696
const newLSClient = await createServer(workspaceSetting, serverId, serverName, outputChannel, {

src/extension.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
116116

117117
export async function deactivate(): Promise<void> {
118118
if (lsClient) {
119-
await lsClient.stop();
119+
try {
120+
await lsClient.stop();
121+
} catch (ex) {
122+
traceError(`Server: Stop failed: ${ex}`);
123+
}
120124
}
121125
}

0 commit comments

Comments
 (0)