mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-03 14:01:30 +01:00
## Summary When a worktree root is moved outside Zed, open buffers still remain registered with the language server under their old URIs. Since subsequent requests use the new URIs, the server doesn't recognise those documents, so requests fail (phpactor reports `UnknownDocument`). The issue is that moving a root doesn't change worktree-relative paths, so `BufferStore` never detects a file path change. I've addressed this by emitting an `UpdatedRootAbsPath` event from `update_abs_path_and_refresh`, allowing `LspStore` to send `didClose` for the old URI and `didOpen` for the new one for each registered buffer in that worktree. Closes #67205 ## Testing - Added two tests, one moving a single-file worktree and one moving a directory worktree with a file inside. Both fail without the change and pass with it. - Related existing tests in `project` and `worktree` pass. - No manual build yet, since I'm low on disk space; the behaviour is covered by the two tests above. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [ ] UI changes follow the checklist (https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed language servers not being notified when an open file's worktree root is moved outside Zed.