diff --git a/src/integrations/workspace/WorkspaceTracker.ts b/src/integrations/workspace/WorkspaceTracker.ts index 69fc860d37..df20a2bfe4 100644 --- a/src/integrations/workspace/WorkspaceTracker.ts +++ b/src/integrations/workspace/WorkspaceTracker.ts @@ -27,24 +27,22 @@ class WorkspaceTracker { } private registerListeners() { - // Create a file system watcher for all files - const watcher = vscode.workspace.createFileSystemWatcher('**') + const watcher = vscode.workspace.createFileSystemWatcher("**") - // Listen for file creation this.disposables.push( watcher.onDidCreate(async (uri) => { await this.addFilePath(uri.fsPath) this.workspaceDidUpdate() - }) + }), ) - // Listen for file deletion + // Renaming files triggers a delete and create event this.disposables.push( watcher.onDidDelete(async (uri) => { if (await this.removeFilePath(uri.fsPath)) { this.workspaceDidUpdate() } - }) + }), ) // Listen for file changes (which could include renames) @@ -52,7 +50,7 @@ class WorkspaceTracker { watcher.onDidChange(async (uri) => { await this.addFilePath(uri.fsPath) this.workspaceDidUpdate() - }) + }), ) // Add the watcher itself to disposables