From dc5efcedbafe03e3e8d0143c19db9e8beb07b03d Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Fri, 23 Apr 2021 14:13:44 -0700 Subject: [PATCH] Watch for changes in directory structure This ensures that directories renamed, added or deleted are properly checked to see if they contain tests. The test tree will be correctly updated when any directory changes.s --- extensions/ql-vscode/src/qltest-discovery.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/ql-vscode/src/qltest-discovery.ts b/extensions/ql-vscode/src/qltest-discovery.ts index 0cda0be3d..31bd9bf7d 100644 --- a/extensions/ql-vscode/src/qltest-discovery.ts +++ b/extensions/ql-vscode/src/qltest-discovery.ts @@ -167,9 +167,11 @@ export class QLTestDiscovery extends Discovery { protected update(results: QLTestDiscoveryResults): void { this._testDirectory = results.testDirectory; - // Watch for changes to any `.ql` or `.qlref` file in any of the QL packs that contain tests. this.watcher.clear(); + // Watch for changes to any `.ql` or `.qlref` file in any of the QL packs that contain tests. this.watcher.addWatch(new RelativePattern(results.watchPath, '**/*.{ql,qlref}')); + // need to explicitly watch for changes to directories themselves. + this.watcher.addWatch(new RelativePattern(results.watchPath, '**/')); this._onDidChangeTests.fire(); }