Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch for changes in directory structure #846

Merged
merged 2 commits into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [UNRELEASED]

- Ensure changes in directories that contain tests will be properly updated in the test explorer. [#846](https://github.com/github/vscode-codeql/pull/846)

## 1.4.7 - 23 April 2021

- Fix a bug that prevented the results view from being loaded. [#842](https://github.com/github/vscode-codeql/pull/842)
Expand Down
4 changes: 3 additions & 1 deletion extensions/ql-vscode/src/qltest-discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,11 @@ export class QLTestDiscovery extends Discovery<QLTestDiscoveryResults> {
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, '**/'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is all directories under a workspace folder? Any noticeable hit to performance on a large repo? Do we need to exclude database source archives?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing noticeable. I renamed the ql folder that is a submodule in the starter repo and there was no noticeable lag in the file explorer. The test explorer itself took a few seconds to update, but I think that's fair because it needs to re-discover the entire tree.

We don't need to do any special handling for source archives since they are readonly and aren't watched for changes.

this._onDidChangeTests.fire();
}

Expand Down