zed/crates/project
Ibrahim Khan 2243c13b9b
project: Fix content swap when an LSP rename also renames the file (#59104)
A "rename symbol" whose workspace edit also renames the file (a
`TextDocumentEdit` followed by a `RenameFile` resource operation) only
applied the text edit to the in-memory buffer. The on-disk file still
held the pre-edit content, so the blind `fs.rename` moved stale bytes to
the new path while the edited buffer was stranded at the old path,
swapping the two files' contents.

This persists a dirty buffer for the rename source before renaming, so
the new file receives the edited content and the now-clean buffer can't
be saved back to the old path.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #59077

Release Notes:

- Fixed a symbol rename that also renames the file swapping the contents
of the old and new files
2026-07-08 12:21:10 +00:00
..
src project: Fix content swap when an LSP rename also renames the file (#59104) 2026-07-08 12:21:10 +00:00
tests/integration project: Fix content swap when an LSP rename also renames the file (#59104) 2026-07-08 12:21:10 +00:00
Cargo.toml Remove gpui's dependency on async-process (#59358) 2026-06-16 13:47:55 +00:00
LICENSE-GPL