mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-21 04:41:16 -05:00
Remove logs
This commit is contained in:
@@ -12,28 +12,21 @@ class WorkspaceTracker {
|
|||||||
private filePaths: Set<string> = new Set()
|
private filePaths: Set<string> = new Set()
|
||||||
|
|
||||||
constructor(provider: ClaudeDevProvider) {
|
constructor(provider: ClaudeDevProvider) {
|
||||||
console.log("WorkspaceTracker: Initializing")
|
|
||||||
this.providerRef = new WeakRef(provider)
|
this.providerRef = new WeakRef(provider)
|
||||||
this.registerListeners()
|
this.registerListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
async initializeFilePaths() {
|
async initializeFilePaths() {
|
||||||
console.log("WorkspaceTracker: Initializing file paths")
|
|
||||||
// should not auto get filepaths for desktop since it would immediately show permission popup before claude every creates a file
|
// should not auto get filepaths for desktop since it would immediately show permission popup before claude every creates a file
|
||||||
|
|
||||||
if (!cwd) {
|
if (!cwd) {
|
||||||
console.log("WorkspaceTracker: No workspace folder found")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const [files, _] = await listFiles(cwd, true, 500)
|
const [files, _] = await listFiles(cwd, true, 500)
|
||||||
console.log(`WorkspaceTracker: Found ${files.length} files`)
|
|
||||||
files.forEach((file) => this.filePaths.add(this.normalizeFilePath(file)))
|
files.forEach((file) => this.filePaths.add(this.normalizeFilePath(file)))
|
||||||
console.log(this.filePaths)
|
|
||||||
this.workspaceDidUpdate()
|
this.workspaceDidUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
private registerListeners() {
|
private registerListeners() {
|
||||||
console.log("WorkspaceTracker: Registering listeners")
|
|
||||||
// Listen for file creation
|
// Listen for file creation
|
||||||
this.disposables.push(vscode.workspace.onDidCreateFiles(this.onFilesCreated.bind(this)))
|
this.disposables.push(vscode.workspace.onDidCreateFiles(this.onFilesCreated.bind(this)))
|
||||||
|
|
||||||
@@ -43,15 +36,18 @@ class WorkspaceTracker {
|
|||||||
// Listen for file renaming
|
// Listen for file renaming
|
||||||
this.disposables.push(vscode.workspace.onDidRenameFiles(this.onFilesRenamed.bind(this)))
|
this.disposables.push(vscode.workspace.onDidRenameFiles(this.onFilesRenamed.bind(this)))
|
||||||
|
|
||||||
// Listen for file changes
|
/*
|
||||||
this.disposables.push(vscode.workspace.onDidChangeTextDocument(this.onFileChanged.bind(this)))
|
An event that is emitted when a workspace folder is added or removed.
|
||||||
|
**Note:** this event will not fire if the first workspace folder is added, removed or changed,
|
||||||
// Listen for workspace folder changes
|
because in that case the currently executing extensions (including the one that listens to this
|
||||||
this.disposables.push(vscode.workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged.bind(this)))
|
event) will be terminated and restarted so that the (deprecated) `rootPath` property is updated
|
||||||
|
to point to the first workspace folder.
|
||||||
|
*/
|
||||||
|
// In other words, we don't have to worry about the root workspace folder ([0]) changing since the extension will be restarted and our cwd will be updated to reflect the new workspace folder. (We don't care about non root workspace folders, since claude will only be working within the root folder cwd)
|
||||||
|
// this.disposables.push(vscode.workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged.bind(this)))
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onFilesCreated(event: vscode.FileCreateEvent) {
|
private async onFilesCreated(event: vscode.FileCreateEvent) {
|
||||||
console.log(`WorkspaceTracker: Files created - ${event.files.length} file(s)`)
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
event.files.map(async (file) => {
|
event.files.map(async (file) => {
|
||||||
await this.addFilePath(file.fsPath)
|
await this.addFilePath(file.fsPath)
|
||||||
@@ -61,7 +57,6 @@ class WorkspaceTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async onFilesDeleted(event: vscode.FileDeleteEvent) {
|
private async onFilesDeleted(event: vscode.FileDeleteEvent) {
|
||||||
console.log(`WorkspaceTracker: Files deleted - ${event.files.length} file(s)`)
|
|
||||||
let updated = false
|
let updated = false
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
event.files.map(async (file) => {
|
event.files.map(async (file) => {
|
||||||
@@ -76,7 +71,6 @@ class WorkspaceTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async onFilesRenamed(event: vscode.FileRenameEvent) {
|
private async onFilesRenamed(event: vscode.FileRenameEvent) {
|
||||||
console.log(`WorkspaceTracker: Files renamed - ${event.files.length} file(s)`)
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
event.files.map(async (file) => {
|
event.files.map(async (file) => {
|
||||||
await this.removeFilePath(file.oldUri.fsPath)
|
await this.removeFilePath(file.oldUri.fsPath)
|
||||||
@@ -86,38 +80,7 @@ class WorkspaceTracker {
|
|||||||
this.workspaceDidUpdate()
|
this.workspaceDidUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onFileChanged(event: vscode.TextDocumentChangeEvent) {
|
|
||||||
const filePath = await this.addFilePath(event.document.uri.fsPath)
|
|
||||||
if (!this.filePaths.has(filePath)) {
|
|
||||||
console.log(`WorkspaceTracker: New file changed - ${filePath}`)
|
|
||||||
this.filePaths.add(filePath)
|
|
||||||
this.workspaceDidUpdate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async onWorkspaceFoldersChanged(event: vscode.WorkspaceFoldersChangeEvent) {
|
|
||||||
console.log(
|
|
||||||
`WorkspaceTracker: Workspace folders changed - Added: ${event.added.length}, Removed: ${event.removed.length}`
|
|
||||||
)
|
|
||||||
for (const folder of event.added) {
|
|
||||||
const [files, _] = await listFiles(folder.uri.fsPath, true, 50) // at most 50 files
|
|
||||||
console.log(`WorkspaceTracker: Adding ${files.length} files from new folder`)
|
|
||||||
await Promise.all(files.map((file) => this.addFilePath(file)))
|
|
||||||
}
|
|
||||||
for (const folder of event.removed) {
|
|
||||||
const folderPath = await this.addFilePath(folder.uri.fsPath)
|
|
||||||
console.log(`WorkspaceTracker: Removing files from deleted folder - ${folderPath}`)
|
|
||||||
this.filePaths.forEach((filePath) => {
|
|
||||||
if (filePath.startsWith(folderPath)) {
|
|
||||||
this.filePaths.delete(filePath)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.workspaceDidUpdate()
|
|
||||||
}
|
|
||||||
|
|
||||||
private workspaceDidUpdate() {
|
private workspaceDidUpdate() {
|
||||||
console.log(`WorkspaceTracker: Workspace updated. Current file count: ${this.filePaths.size}`)
|
|
||||||
if (!cwd) {
|
if (!cwd) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -156,7 +119,6 @@ class WorkspaceTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public dispose() {
|
public dispose() {
|
||||||
console.log("WorkspaceTracker: Disposing")
|
|
||||||
this.disposables.forEach((d) => d.dispose())
|
this.disposables.forEach((d) => d.dispose())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user