mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-22 05:11:06 -05:00
Updated workspace tracker from Cline
This commit is contained in:
@@ -27,10 +27,8 @@ class WorkspaceTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private registerListeners() {
|
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(
|
this.disposables.push(
|
||||||
watcher.onDidCreate(async (uri) => {
|
watcher.onDidCreate(async (uri) => {
|
||||||
await this.addFilePath(uri.fsPath)
|
await this.addFilePath(uri.fsPath)
|
||||||
@@ -38,7 +36,7 @@ class WorkspaceTracker {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
// Listen for file deletion
|
// Renaming files triggers a delete and create event
|
||||||
this.disposables.push(
|
this.disposables.push(
|
||||||
watcher.onDidDelete(async (uri) => {
|
watcher.onDidDelete(async (uri) => {
|
||||||
if (await this.removeFilePath(uri.fsPath)) {
|
if (await this.removeFilePath(uri.fsPath)) {
|
||||||
@@ -47,15 +45,6 @@ class WorkspaceTracker {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
// Listen for file changes (which could include renames)
|
|
||||||
this.disposables.push(
|
|
||||||
watcher.onDidChange(async (uri) => {
|
|
||||||
await this.addFilePath(uri.fsPath)
|
|
||||||
this.workspaceDidUpdate()
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
// Add the watcher itself to disposables
|
|
||||||
this.disposables.push(watcher)
|
this.disposables.push(watcher)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +57,7 @@ class WorkspaceTracker {
|
|||||||
filePaths: Array.from(this.filePaths).map((file) => {
|
filePaths: Array.from(this.filePaths).map((file) => {
|
||||||
const relativePath = path.relative(cwd, file).toPosix()
|
const relativePath = path.relative(cwd, file).toPosix()
|
||||||
return file.endsWith("/") ? relativePath + "/" : relativePath
|
return file.endsWith("/") ? relativePath + "/" : relativePath
|
||||||
}),
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user