Only expose event to subclasses, instead of event emitter

This commit is contained in:
Robert
2023-06-19 10:54:30 +01:00
parent af62a92c5b
commit 70681253eb
4 changed files with 9 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
import { Discovery } from "../discovery";
import {
Event,
EventEmitter,
RelativePattern,
Uri,
@@ -36,7 +37,7 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
private pathData: T[] = [];
/** Event that fires whenever the contents of `pathData` changes */
protected readonly onDidChangePathDataEmitter: AppEventEmitter<void>;
private readonly onDidChangePathDataEmitter: AppEventEmitter<void>;
/**
* The set of file paths that may have changed on disk since the last time
@@ -75,6 +76,10 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
return this.pathData;
}
protected get onDidChangePathData(): Event<void> {
return this.onDidChangePathDataEmitter.event;
}
/**
* Compute any extra data to be stored regarding the given path.
*/

View File

@@ -48,7 +48,7 @@ export class QueryDiscovery
* Event that fires when the set of queries in the workspace changes.
*/
public get onDidChangeQueries(): Event<void> {
return this.onDidChangePathDataEmitter.event;
return this.onDidChangePathData;
}
/**

View File

@@ -27,7 +27,7 @@ export class QueryPackDiscovery extends FilePathDiscovery<QueryPack> {
* Event that fires when the set of query packs in the workspace changes.
*/
public get onDidChangeQueryPacks(): Event<void> {
return this.onDidChangePathDataEmitter.event;
return this.onDidChangePathData;
}
/**

View File

@@ -25,7 +25,7 @@ class TestFilePathDiscovery extends FilePathDiscovery<TestData> {
}
public get onDidChangePaths() {
return this.onDidChangePathDataEmitter.event;
return this.onDidChangePathData;
}
public getPathData(): readonly TestData[] {