Skip to content

Commit 7068125

Browse files
Only expose event to subclasses, instead of event emitter
1 parent af62a92 commit 7068125

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Discovery } from "../discovery";
22
import {
3+
Event,
34
EventEmitter,
45
RelativePattern,
56
Uri,
@@ -36,7 +37,7 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
3637
private pathData: T[] = [];
3738

3839
/** Event that fires whenever the contents of `pathData` changes */
39-
protected readonly onDidChangePathDataEmitter: AppEventEmitter<void>;
40+
private readonly onDidChangePathDataEmitter: AppEventEmitter<void>;
4041

4142
/**
4243
* 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 {
7576
return this.pathData;
7677
}
7778

79+
protected get onDidChangePathData(): Event<void> {
80+
return this.onDidChangePathDataEmitter.event;
81+
}
82+
7883
/**
7984
* Compute any extra data to be stored regarding the given path.
8085
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class QueryDiscovery
4848
* Event that fires when the set of queries in the workspace changes.
4949
*/
5050
public get onDidChangeQueries(): Event<void> {
51-
return this.onDidChangePathDataEmitter.event;
51+
return this.onDidChangePathData;
5252
}
5353

5454
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class QueryPackDiscovery extends FilePathDiscovery<QueryPack> {
2727
* Event that fires when the set of query packs in the workspace changes.
2828
*/
2929
public get onDidChangeQueryPacks(): Event<void> {
30-
return this.onDidChangePathDataEmitter.event;
30+
return this.onDidChangePathData;
3131
}
3232

3333
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class TestFilePathDiscovery extends FilePathDiscovery<TestData> {
2525
}
2626

2727
public get onDidChangePaths() {
28-
return this.onDidChangePathDataEmitter.event;
28+
return this.onDidChangePathData;
2929
}
3030

3131
public getPathData(): readonly TestData[] {

0 commit comments

Comments
 (0)