Skip to content

Commit f3780c6

Browse files
authored
Merge pull request #3158 from github/koesie10/fix-qltest-discovery-watcher
Do not reregister watchers on every file change for qltests
2 parents 262744e + 218be87 commit f3780c6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

extensions/ql-vscode/src/query-testing/qltest-discovery.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ export class QLTestDiscovery extends Discovery {
3131
super("QL Test Discovery", extLogger);
3232

3333
this.push(this.watcher.onDidChange(this.handleDidChange, this));
34+
35+
// Watch for changes to any `.ql` or `.qlref` file in any of the QL packs that contain tests.
36+
this.watcher.addWatch(
37+
new RelativePattern(this.workspaceFolder.uri.fsPath, "**/*.{ql,qlref}"),
38+
);
39+
// need to explicitly watch for changes to directories themselves.
40+
this.watcher.addWatch(
41+
new RelativePattern(this.workspaceFolder.uri.fsPath, "**/"),
42+
);
3443
}
3544

3645
/**
@@ -56,15 +65,6 @@ export class QLTestDiscovery extends Discovery {
5665
protected async discover() {
5766
this._testDirectory = await this.discoverTests();
5867

59-
this.watcher.clear();
60-
// Watch for changes to any `.ql` or `.qlref` file in any of the QL packs that contain tests.
61-
this.watcher.addWatch(
62-
new RelativePattern(this.workspaceFolder.uri.fsPath, "**/*.{ql,qlref}"),
63-
);
64-
// need to explicitly watch for changes to directories themselves.
65-
this.watcher.addWatch(
66-
new RelativePattern(this.workspaceFolder.uri.fsPath, "**/"),
67-
);
6868
this._onDidChangeTests.fire(undefined);
6969
}
7070

0 commit comments

Comments
 (0)