Skip to content

Commit af62a92

Browse files
Make pathData private to FilePathDiscovery
1 parent da92a67 commit af62a92

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

extensions/ql-vscode/src/common/vscode/file-path-discovery.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface PathData {
3333
*/
3434
export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
3535
/** The set of known paths and associated data that we are tracking */
36-
protected pathData: T[] = [];
36+
private pathData: T[] = [];
3737

3838
/** Event that fires whenever the contents of `pathData` changes */
3939
protected readonly onDidChangePathDataEmitter: AppEventEmitter<void>;
@@ -71,6 +71,10 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
7171
this.push(this.watcher.onDidChange(this.fileChanged.bind(this)));
7272
}
7373

74+
protected getPathData(): readonly T[] {
75+
return this.pathData;
76+
}
77+
7478
/**
7579
* Compute any extra data to be stored regarding the given path.
7680
*/

extensions/ql-vscode/src/queries-panel/query-discovery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class QueryDiscovery
5959
public buildQueryTree(): Array<FileTreeNode<string>> {
6060
const roots = [];
6161
for (const workspaceFolder of getOnDiskWorkspaceFoldersObjects()) {
62-
const queriesInRoot = this.pathData.filter((query) =>
62+
const queriesInRoot = this.getPathData().filter((query) =>
6363
containsPath(workspaceFolder.uri.fsPath, query.path),
6464
);
6565
if (queriesInRoot.length === 0) {

extensions/ql-vscode/src/queries-panel/query-pack-discovery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class QueryPackDiscovery extends FilePathDiscovery<QueryPack> {
3737
*/
3838
public getLanguageForQueryFile(queryPath: string): QueryLanguage | undefined {
3939
// Find all packs in a higher directory than the query
40-
const packs = this.pathData.filter((queryPack) =>
40+
const packs = this.getPathData().filter((queryPack) =>
4141
containsPath(dirname(queryPack.path), queryPath),
4242
);
4343

extensions/ql-vscode/test/vscode-tests/minimal-workspace/common/vscode/file-path-discovery.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class TestFilePathDiscovery extends FilePathDiscovery<TestData> {
2828
return this.onDidChangePathDataEmitter.event;
2929
}
3030

31-
public getPathData(): TestData[] {
32-
return this.pathData;
31+
public getPathData(): readonly TestData[] {
32+
return super.getPathData();
3333
}
3434

3535
protected async getDataForPath(path: string): Promise<TestData> {

0 commit comments

Comments
 (0)