@@ -8,10 +8,7 @@ import type { Log } from "sarif";
88import { SemVer } from "semver" ;
99import type { Readable } from "stream" ;
1010import 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
1613import type {
1714 BqrsInfo ,
@@ -41,10 +38,6 @@ import type { CliFeatures, VersionAndFeatures } from "./cli-version";
4138import { ExitCodeError , getCliError } from "./cli-errors" ;
4239import { UserCancellationException } from "../common/vscode/progress" ;
4340import 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