Skip to content

Commit 887456e

Browse files
authored
Fix bug where new files won't show up in files dropdown (RooCodeInc#1704)
* Fix bug where new files won't show up in files dropdown * Create small-gifts-count.md
1 parent 134020d commit 887456e

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

.changeset/small-gifts-count.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
Fix bug where new files won't show up in files dropdown

src/core/Cline.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,11 @@ export class Cline {
18351835
`${newProblemsMessage}`,
18361836
)
18371837
}
1838+
1839+
if (!fileExists) {
1840+
this.providerRef.deref()?.workspaceTracker?.populateFilePaths()
1841+
}
1842+
18381843
await this.diffViewProvider.reset()
18391844
await this.saveCheckpoint()
18401845
break
@@ -2387,6 +2392,10 @@ export class Cline {
23872392
if (userRejected) {
23882393
this.didRejectTool = true
23892394
}
2395+
2396+
// Re-populate file paths in case the command modified the workspace (vscode listeners do not trigger unless the user manually creates/deletes files)
2397+
this.providerRef.deref()?.workspaceTracker?.populateFilePaths()
2398+
23902399
pushToolResult(result)
23912400
await this.saveCheckpoint()
23922401
break

src/core/webview/ClineProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
102102
private disposables: vscode.Disposable[] = []
103103
private view?: vscode.WebviewView | vscode.WebviewPanel
104104
private cline?: Cline
105-
private workspaceTracker?: WorkspaceTracker
105+
workspaceTracker?: WorkspaceTracker
106106
mcpHub?: McpHub
107107
private authManager: FirebaseAuthManager
108108
private latestAnnouncementId = "jan-20-2025" // update to some unique identifier when we add a new announcement
@@ -379,7 +379,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
379379
switch (message.type) {
380380
case "webviewDidLaunch":
381381
this.postStateToWebview()
382-
this.workspaceTracker?.initializeFilePaths() // don't await
382+
this.workspaceTracker?.populateFilePaths() // don't await
383383
getTheme().then((theme) =>
384384
this.postMessageToWebview({
385385
type: "theme",

src/integrations/workspace/WorkspaceTracker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class WorkspaceTracker {
1616
this.registerListeners()
1717
}
1818

19-
async initializeFilePaths() {
19+
async populateFilePaths() {
2020
// should not auto get filepaths for desktop since it would immediately show permission popup before cline ever creates a file
2121
if (!cwd) {
2222
return

0 commit comments

Comments
 (0)