Skip to content

Commit 9804161

Browse files
committed
fix(code-index): deliver status to providers without a workspace binding
1 parent 312ab94 commit 9804161

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎src/__tests__/extension.spec.ts‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,14 @@ describe("extension.ts", () => {
303303
}
304304
})
305305

306-
test.each(["/other-workspace", undefined, ""])(
307-
"does not publish workspace metadata to a provider bound to %s",
308-
async (workspacePath) => {
306+
test.each([
307+
{ workspacePath: "/other-workspace", receivesStatus: false },
308+
{ workspacePath: "/workspace", receivesStatus: true },
309+
{ workspacePath: undefined, receivesStatus: true },
310+
{ workspacePath: "", receivesStatus: true },
311+
])(
312+
"routes status for provider workspace=$workspacePath with receivesStatus=$receivesStatus",
313+
async ({ workspacePath, receivesStatus }) => {
309314
vi.resetModules()
310315
const { CodeIndexScope } = await import("../services/code-index/code-index-scope")
311316
const { ClineProvider } = await import("../core/webview/ClineProvider")
@@ -329,7 +334,14 @@ describe("extension.ts", () => {
329334
}
330335
scope["statusManager"]!["publishStatus"](status)
331336
await Promise.resolve()
332-
expect(provider.postMessageToWebview).not.toHaveBeenCalled()
337+
if (receivesStatus) {
338+
expect(provider.postMessageToWebview).toHaveBeenCalledExactlyOnceWith({
339+
type: "indexingStatusUpdate",
340+
values: status,
341+
})
342+
} else {
343+
expect(provider.postMessageToWebview).not.toHaveBeenCalled()
344+
}
333345
scope.dispose()
334346
} finally {
335347
getAll.mockReturnValue([])

‎src/services/code-index/code-index-status-manager.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class CodeIndexStatusManager implements vscode.Disposable {
5353
private async publishStatusToProvider(provider: ClineProvider, status: CodeIndexStatus): Promise<void> {
5454
try {
5555
const workspacePath = provider.workspacePath
56-
if (!workspacePath || workspacePath !== status.workspacePath) return
56+
if (workspacePath && workspacePath !== status.workspacePath) return
5757

5858
await provider.postMessageToWebview({ type: "indexingStatusUpdate", values: status })
5959
} catch (error) {

0 commit comments

Comments
 (0)