diff --git a/src/services/code-index/manager.ts b/src/services/code-index/manager.ts index 465fa95d0c..5007a88e6a 100644 --- a/src/services/code-index/manager.ts +++ b/src/services/code-index/manager.ts @@ -216,7 +216,11 @@ export class CodeIndexManager { */ public dispose(): void { if (this._orchestrator) { - this.stopWatcher() + this.stopWatcher() // This calls _orchestrator.stopWatcher() + // Ensure orchestrator is fully cleaned up if it has a dispose method + if (typeof (this._orchestrator as any).dispose === "function") { + ;(this._orchestrator as any).dispose() + } } this._stateManager.dispose() } diff --git a/src/services/code-index/orchestrator.ts b/src/services/code-index/orchestrator.ts index 5784f0dcfc..0b2f4319c8 100644 --- a/src/services/code-index/orchestrator.ts +++ b/src/services/code-index/orchestrator.ts @@ -219,4 +219,13 @@ export class CodeIndexOrchestrator { public get state(): IndexingState { return this.stateManager.state } + + /** + * Disposes of resources held by the orchestrator. + */ + public dispose(): void { + this.stopWatcher() + // Dispose other resources if any (e.g., if scanner or vectorStore had disposables not managed elsewhere) + // For now, stopWatcher handles the primary disposable (fileWatcher). + } }