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.32k stars 2.87k forks source link

Undoing a rename that caused a file name to change doesn't revert the file name #5369

Open JosephTLyons opened 2 years ago

JosephTLyons commented 2 years ago

Undoing a rename that caused a file name to change doesn't revert the file name

petros commented 2 months ago

Hey @JosephTLyons is this still an issue? I watched the video but I am not entirely sure how to reproduce this. Could you share some steps and what's expected instead? I think you use keyboard shortcuts in the video but I am not sure which ones.

JosephTLyons commented 2 months ago

Yeah for sure. I just went through and tested this again and it is still an issue on my end.

Here is approximately the same line of code as in the video:

What I did was a Rename Symbol action on clock_characters - I renamed it clock_characterssss. Doing this also adjusts the name of the file that that symbol is associated with: clock_characterssss.rs.

I think the language server does this. Running an undo does revert the changes to the code in the current file (clock.rs), but it does not rename the clock_characterssss.rs file back to clock_characters.rs, which causes the code to go into a broken state.

I feel like this will take some custom logic of holding the previous file name in memory, but maybe I'm wrong and there's something offered by the language server that we aren't tapping into - so this could either be challenging or easy, depending.

petros commented 2 months ago

Thank you @JosephTLyons! I can reproduce it now. Indeed, I think I found the code that does this, but I am not entirely sure what the best approach is to include reverting the filename change with the undo action. I am going to investigate further.