Skip to content

Commit 94fe3e0

Browse files
Always trigger pathsChanged listener after initial refresh
1 parent 6fe7b82 commit 94fe3e0

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
127127
});
128128

129129
this.updateWatchers();
130-
return this.refresh();
130+
await this.refresh();
131+
this.onDidChangePathDataEmitter.fire();
131132
}
132133

133134
private workspaceFoldersChanged(event: WorkspaceFoldersChangeEvent) {

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,26 @@ describe("FilePathDiscovery", () => {
159159
new Set([{ path: join(workspacePath, "1.test"), contents: "1" }]),
160160
);
161161
});
162+
163+
it("should trigger listener when paths are found", async () => {
164+
makeTestFile(join(workspacePath, "123.test"));
165+
166+
const didChangePathsListener = jest.fn();
167+
discovery.onDidChangePaths(didChangePathsListener);
168+
169+
await discovery.initialRefresh();
170+
171+
expect(didChangePathsListener).toHaveBeenCalled();
172+
});
173+
174+
it("should trigger listener when no paths are found", async () => {
175+
const didChangePathsListener = jest.fn();
176+
discovery.onDidChangePaths(didChangePathsListener);
177+
178+
await discovery.initialRefresh();
179+
180+
expect(didChangePathsListener).toHaveBeenCalled();
181+
});
162182
});
163183

164184
describe("file added", () => {

0 commit comments

Comments
 (0)