Make pathData private to FilePathDiscovery
This commit is contained in:
@@ -33,7 +33,7 @@ interface PathData {
|
||||
*/
|
||||
export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
|
||||
/** The set of known paths and associated data that we are tracking */
|
||||
protected pathData: T[] = [];
|
||||
private pathData: T[] = [];
|
||||
|
||||
/** Event that fires whenever the contents of `pathData` changes */
|
||||
protected readonly onDidChangePathDataEmitter: AppEventEmitter<void>;
|
||||
@@ -71,6 +71,10 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
|
||||
this.push(this.watcher.onDidChange(this.fileChanged.bind(this)));
|
||||
}
|
||||
|
||||
protected getPathData(): readonly T[] {
|
||||
return this.pathData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute any extra data to be stored regarding the given path.
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,7 @@ export class QueryDiscovery
|
||||
public buildQueryTree(): Array<FileTreeNode<string>> {
|
||||
const roots = [];
|
||||
for (const workspaceFolder of getOnDiskWorkspaceFoldersObjects()) {
|
||||
const queriesInRoot = this.pathData.filter((query) =>
|
||||
const queriesInRoot = this.getPathData().filter((query) =>
|
||||
containsPath(workspaceFolder.uri.fsPath, query.path),
|
||||
);
|
||||
if (queriesInRoot.length === 0) {
|
||||
|
||||
@@ -37,7 +37,7 @@ export class QueryPackDiscovery extends FilePathDiscovery<QueryPack> {
|
||||
*/
|
||||
public getLanguageForQueryFile(queryPath: string): QueryLanguage | undefined {
|
||||
// Find all packs in a higher directory than the query
|
||||
const packs = this.pathData.filter((queryPack) =>
|
||||
const packs = this.getPathData().filter((queryPack) =>
|
||||
containsPath(dirname(queryPack.path), queryPath),
|
||||
);
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ class TestFilePathDiscovery extends FilePathDiscovery<TestData> {
|
||||
return this.onDidChangePathDataEmitter.event;
|
||||
}
|
||||
|
||||
public getPathData(): TestData[] {
|
||||
return this.pathData;
|
||||
public getPathData(): readonly TestData[] {
|
||||
return super.getPathData();
|
||||
}
|
||||
|
||||
protected async getDataForPath(path: string): Promise<TestData> {
|
||||
|
||||
Reference in New Issue
Block a user