Skip to content

Commit

Permalink
don't await stopClient to make sure that ZLS is not started twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix committed Dec 30, 2024
1 parent ffc2058 commit 840c16e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/zls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function restartClient(context: vscode.ExtensionContext): Promise<v

try {
const newClient = await startClient(result.exe, result.version);
await stopClient();
void stopClient();
client = newClient;
updateStatusItem(result.version);
} catch (reason) {
Expand Down Expand Up @@ -94,11 +94,12 @@ async function startClient(zlsPath: string, zlsVersion: semver.SemVer): Promise<

async function stopClient(): Promise<void> {
if (!client) return;
const oldClient = client;
client = null;
// The `stop` call will send the "shutdown" notification to the LSP
await client.stop();
await oldClient.stop();
// The `dipose` call will send the "exit" request to the LSP which actually tells the child process to exit
await client.dispose();
client = null;
await oldClient.dispose();
}

/** returns the file system path to the zls executable */
Expand Down

0 comments on commit 840c16e

Please sign in to comment.