Skip to content

Commit 17542d1

Browse files
author
Stephan Brandauer
committed
remove notification, when we are restarting the language client anyways
1 parent 6fd3d20 commit 17542d1

File tree

1 file changed

+11
-30
lines changed
  • extensions/ql-vscode/src/codeql-cli

1 file changed

+11
-30
lines changed

extensions/ql-vscode/src/codeql-cli/cli.ts

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ import type { Log } from "sarif";
88
import { SemVer } from "semver";
99
import type { Readable } from "stream";
1010
import tk from "tree-kill";
11-
import type { CancellationToken, Disposable } from "vscode";
12-
import { Uri } from "vscode";
13-
14-
import { existsSync } from "fs";
11+
import type { CancellationToken, Disposable, Uri } from "vscode";
1512

1613
import type {
1714
BqrsInfo,
@@ -41,10 +38,6 @@ import type { CliFeatures, VersionAndFeatures } from "./cli-version";
4138
import { ExitCodeError, getCliError } from "./cli-errors";
4239
import { UserCancellationException } from "../common/vscode/progress";
4340
import type { LanguageClient } from "vscode-languageclient/node";
44-
import {
45-
DidChangeWatchedFilesNotification,
46-
FileChangeType,
47-
} from "vscode-languageclient/node";
4841

4942
/**
5043
* The version of the SARIF format that we are using.
@@ -1598,7 +1591,7 @@ export class CodeQLCliServer implements Disposable {
15981591
args,
15991592
`Adding and installing ${queryLanguage} pack dependency.`,
16001593
);
1601-
await this.notifyPackChanged(dir);
1594+
await this.notifyPackInstalled();
16021595
return ret;
16031596
}
16041597

@@ -1644,7 +1637,7 @@ export class CodeQLCliServer implements Disposable {
16441637
args,
16451638
"Installing pack dependencies",
16461639
);
1647-
await this.notifyPackChanged(dir);
1640+
await this.notifyPackInstalled();
16481641
return ret;
16491642
}
16501643

@@ -1763,26 +1756,14 @@ export class CodeQLCliServer implements Disposable {
17631756
this._versionChangedListeners.push(listener);
17641757
}
17651758

1766-
private async notifyPackChanged(packDir: string) {
1767-
const packFilePath = join(packDir, "codeql-pack.yml");
1768-
if (!existsSync(packFilePath)) {
1769-
throw new Error(`Pack file ${packFilePath} does not exist`);
1770-
}
1771-
await this.languageClient.sendNotification(
1772-
DidChangeWatchedFilesNotification.type,
1773-
{
1774-
changes: [
1775-
{
1776-
type: FileChangeType.Changed,
1777-
uri: Uri.file(packFilePath).toString(),
1778-
},
1779-
],
1780-
},
1781-
);
1782-
1783-
// restarting the language client has the effect of removing compilation
1784-
// errors in open ql/qll files that are caused by the pack not having been
1785-
// installed previously:
1759+
/**
1760+
* This method should be called after a pack has been installed.
1761+
*
1762+
* This restarts the language client. Restarting the language client has the
1763+
* effect of removing compilation errors in open ql/qll files that are caused
1764+
* by the pack not having been installed previously.
1765+
*/
1766+
private async notifyPackInstalled() {
17861767
await this.languageClient.restart();
17871768
}
17881769

0 commit comments

Comments
 (0)