Skip to content

Commit 4039b4f

Browse files
Copilotcklin
andcommitted
Fix race condition in notifyVisibilityChange
Add isRunning() check before sending notifications to the language client to prevent "Client is not running" errors in test environments where the client may not have fully started yet. Co-authored-by: cklin <1418580+cklin@users.noreply.github.com>
1 parent 3f544bf commit 4039b4f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

extensions/ql-vscode/src/language-support/language-client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ export class CodeQLLanguageClient extends LanguageClient {
4545
}
4646

4747
notifyVisibilityChange(editors: readonly TextEditor[]) {
48+
// Only send notification if the language client is running to avoid race conditions
49+
if (!this.isRunning()) {
50+
return;
51+
}
4852
const files = editors
4953
.filter((e) => e.document.uri.scheme === "file")
5054
.map((e) => e.document.uri.toString());

0 commit comments

Comments
 (0)