agent: Make directory context display update on rename (#29189)

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-04-21 19:44:31 -06:00 committed by GitHub
parent c15382c4d8
commit 2e8ee9b64f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 74 additions and 31 deletions

View file

@ -264,10 +264,14 @@ impl AddedContext {
}
AssistantContext::Directory(directory_context) => {
let full_path = directory_context
.worktree
.read(cx)
.full_path(&directory_context.path);
let worktree = directory_context.worktree.read(cx);
// If the directory no longer exists, use its last known path.
let full_path = worktree
.entry_for_id(directory_context.entry_id)
.map_or_else(
|| directory_context.last_path.clone(),
|entry| worktree.full_path(&entry.path).into(),
);
let full_path_string: SharedString =
full_path.to_string_lossy().into_owned().into();
let name = full_path