zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
48.69k stars 2.92k forks source link

Saving a multibuffer, with an excerpt to a deleted file, resurrects the file #9101

Open JosephTLyons opened 7 months ago

JosephTLyons commented 7 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

These two are inconsistent with one another, and a bit more annoyingly, if you save the multi-buffer, the file is silently resurrected. Many times, you may not realize that the dirty status of the multi-buffer has anything to do with the deleted file, since many other exceprts could be in view and/or the multi-buffer was already in a dirty state and you come back and save it later on.

A potential solution is to remove the excerts of deleted files from multi-buffers. This makes things consistent with what happens with an open singleton buffer when its file is deleted and prevents the file from being included in the multi-buffer, so future saves don't resurrect them. Maybe there is some rationale for not doing this, or a way to prevent the side effects of resurrecting a deleted file when saving a multi-buffer that contains an excerpt to one.

Environment

Zed: v0.127.0 (Zed Nightly) OS: macOS 14.3.1 Memory: 64 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

JosephTLyons commented 7 months ago

Let's chat about the potential solution here before anyone jumps on it.

SomeoneToIgnore commented 6 months ago

https://github.com/zed-industries/zed/pull/9813 might have helped with this: now, unless the deleted file was edited in the multibuffer, it should not touch it on save.