Zed editor won't let me change my file

Any Zed users out there? Just now I have my main.rs open. It has some code in it I wrote the other day. Today when I make a change and try to save it Zed reverts my change. First it formats the code. Then it removes my changes as if I had hit undo. Does not happen for other files in my project. Very weird. Any ideas?

Well this wouldn't be zed-specific, and it would still be weird, but is the main.rs file's readonly bit set perhaps?

No. Checked that already:

➜  src git:(master) ls -l 
total 16
-rw-r--r--  1 zicog  staff  330 Jun 18 10:35 main.rs
-rw-r--r--  1 zicog  staff  163 Jun 18 10:35 program.rs

On a Mac by the way.

I have absolutely no idea, but - and I say this knowing absolutely nothing about how Zed works - we have a VSCode user where at the office, and on a few occasions we've ended up in a similar state on his system. We eventually figured it out; it can happen when you have the same file open in multiple "views" (I don't know what the correct terminology is). VSCode is supposed to keep all the "views" of the same file in sync, but if you do some trickery (like updating a file outside the editor (for instance, using your source control)) while having unsaved changes in a "view", then you can end up in a weird state where changes can "disappear".

It would be pretty wild if Zed has this exact same issue, but I mention it only because it sounds so similar to the behavior we've observed. (The lesson we've learned is that if a file is behaving very weirdly in VSCode, then simple close all open "views" of the same file and the problem will disappear).

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.