From ea36f75ca40a7e542127bf537d866ac4e3219622 Mon Sep 17 00:00:00 2001 From: magesh-presidio <131435897+magesh-presidio@users.noreply.github.com> Date: Tue, 28 Jan 2025 11:51:02 +0530 Subject: [PATCH] Fixed extension host termination issue (#27) --- src/core/webview/ClineProvider.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index e265491..2b4eb56 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -128,7 +128,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { private codeIndexAbortController: AbortController private isSideBar: boolean - fileSystemWatcher: HaiFileSystemWatcher + fileSystemWatcher: HaiFileSystemWatcher | undefined constructor( readonly context: vscode.ExtensionContext, @@ -141,9 +141,11 @@ export class ClineProvider implements vscode.WebviewViewProvider { this.mcpHub = new McpHub(this) this.codeIndexAbortController = new AbortController() this.isSideBar = isSideBar - this.vsCodeWorkSpaceFolderFsPath = this.getWorkspacePath() || "" - this.fileSystemWatcher = new HaiFileSystemWatcher(this, this.vsCodeWorkSpaceFolderFsPath) - this.codeIndexBackground() + this.vsCodeWorkSpaceFolderFsPath = (this.getWorkspacePath() || "").trim() + if (this.vsCodeWorkSpaceFolderFsPath) { + this.fileSystemWatcher = new HaiFileSystemWatcher(this, this.vsCodeWorkSpaceFolderFsPath) + this.codeIndexBackground() + } } private getWorkspacePath() { @@ -437,7 +439,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { this.workspaceTracker = undefined this.mcpHub?.dispose() this.mcpHub = undefined - this.fileSystemWatcher.dispose() + this.fileSystemWatcher?.dispose() this.outputChannel.appendLine("Disposed all disposables") ClineProvider.activeInstances.delete(this) }