Skip to content

Commit a7a582d

Browse files
committed
Remove QLPackDiscovery
We no longer rely on qlpacks for our ql test structure. For this reason, we no longer need to do qlpack discovery.
1 parent 5cc9f83 commit a7a582d

File tree

5 files changed

+3
-80
lines changed

5 files changed

+3
-80
lines changed

extensions/ql-vscode/src/qlpack-discovery.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as path from 'path';
2-
import { QLPackDiscovery } from './qlpack-discovery';
32
import { Discovery } from './discovery';
43
import { EventEmitter, Event, Uri, RelativePattern, WorkspaceFolder, env } from 'vscode';
54
import { MultiFileSystemWatcher } from './vscode-utils/multi-file-system-watcher';
@@ -128,13 +127,11 @@ export class QLTestDiscovery extends Discovery<QLTestDiscoveryResults> {
128127
private _testDirectory: QLTestDirectory | undefined;
129128

130129
constructor(
131-
private readonly qlPackDiscovery: QLPackDiscovery,
132130
private readonly workspaceFolder: WorkspaceFolder,
133131
private readonly cliServer: CodeQLCliServer
134132
) {
135133
super('QL Test Discovery');
136134

137-
this.push(this.qlPackDiscovery.onDidChangeQLPacks(this.handleDidChangeQLPacks, this));
138135
this.push(this.watcher.onDidChange(this.handleDidChange, this));
139136
}
140137

@@ -153,21 +150,13 @@ export class QLTestDiscovery extends Discovery<QLTestDiscoveryResults> {
153150
return this._testDirectory;
154151
}
155152

156-
private handleDidChangeQLPacks(): void {
157-
this.refresh();
158-
}
159-
160153
private handleDidChange(uri: Uri): void {
161154
if (!QLTestDiscovery.ignoreTestPath(uri.fsPath)) {
162155
this.refresh();
163156
}
164157
}
165-
static cnt = 0;
166158
protected async discover(): Promise<QLTestDiscoveryResults> {
167-
const timer = 'testDirectory-' + this.workspaceFolder.uri.fsPath + '-' + QLTestDiscovery.cnt++;
168-
console.time(timer);
169159
const testDirectory = await this.discoverTests();
170-
console.timeEnd(timer);
171160
return {
172161
testDirectory,
173162
watchPath: this.workspaceFolder.uri.fsPath

extensions/ql-vscode/src/query-history.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,7 @@ export class QueryHistoryManager extends DisposableObject {
545545
private async tryOpenExternalFile(fileLocation: string) {
546546
const uri = vscode.Uri.file(fileLocation);
547547
try {
548-
await vscode.window.showTextDocument(uri, {
549-
preview: false
550-
});
548+
await vscode.window.showTextDocument(uri, { preview: false });
551549
} catch (e) {
552550
if (
553551
e.message.includes(

extensions/ql-vscode/src/test-adapter.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { TestAdapterRegistrar } from 'vscode-test-adapter-util';
1616
import { QLTestFile, QLTestNode, QLTestDirectory, QLTestDiscovery } from './qltest-discovery';
1717
import { Event, EventEmitter, CancellationTokenSource, CancellationToken } from 'vscode';
1818
import { DisposableObject } from './vscode-utils/disposable-object';
19-
import { QLPackDiscovery } from './qlpack-discovery';
2019
import { CodeQLCliServer } from './cli';
2120
import { getOnDiskWorkspaceFolders } from './helpers';
2221
import { testLogger } from './logging';
@@ -82,7 +81,6 @@ function changeExtension(p: string, ext: string): string {
8281
* Test adapter for QL tests.
8382
*/
8483
export class QLTestAdapter extends DisposableObject implements TestAdapter {
85-
private readonly qlPackDiscovery: QLPackDiscovery;
8684
private readonly qlTestDiscovery: QLTestDiscovery;
8785
private readonly _tests = this.push(
8886
new EventEmitter<TestLoadStartedEvent | TestLoadFinishedEvent>());
@@ -97,10 +95,7 @@ export class QLTestAdapter extends DisposableObject implements TestAdapter {
9795
) {
9896
super();
9997

100-
this.qlPackDiscovery = this.push(new QLPackDiscovery(workspaceFolder, cliServer));
101-
this.qlTestDiscovery = this.push(new QLTestDiscovery(this.qlPackDiscovery, workspaceFolder, cliServer));
102-
// TODO: Don't run test discovery until pack discovery finishes
103-
this.qlPackDiscovery.refresh();
98+
this.qlTestDiscovery = this.push(new QLTestDiscovery(workspaceFolder, cliServer));
10499
this.qlTestDiscovery.refresh();
105100

106101
this.push(this.qlTestDiscovery.onDidChangeTests(this.discoverTests, this));
@@ -176,7 +171,7 @@ export class QLTestAdapter extends DisposableObject implements TestAdapter {
176171
type: 'finished',
177172
suite: testSuite
178173
} as TestLoadFinishedEvent);
179-
}
174+
}
180175

181176
public async run(tests: string[]): Promise<void> {
182177
if (this.runningTask !== undefined) {

extensions/ql-vscode/src/vscode-tests/minimal-workspace/qltest-discovery.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ describe('qltest-discovery', () => {
1616
const hDir = Uri.parse('file:/a/b/c/f/g/h').fsPath;
1717
const iFile = Uri.parse('file:/a/b/c/f/g/h/i.ql').fsPath;
1818
const qlTestDiscover = new QLTestDiscovery(
19-
{ onDidChangeQLPacks: () => ({}) } as any,
2019
{
2120
uri: baseUri,
2221
name: 'My tests'

0 commit comments

Comments
 (0)