zed icon indicating copy to clipboard operation
zed copied to clipboard

Zed warns of closing unsaved file _while_ saving file

Open adamsoutar opened this issue 2 years ago • 3 comments

Check for existing issues

  • [X] Completed

Describe the feature

I wasn't sure whether to file this as a bug or a feature request. I guess things are technically working as intended but this is a bit of an edge case.

Quite often I want to finish editing a file and close it. I hit Cmd+S then Cmd+W in quick succession.

Because my disk is a little sluggish, Zed is still in the process of saving the file when I issue the command to close the tab (the little blue dot is still in the tab, it takes maybe half a second to go away). That causes Zed to pop up a "You haven't saved that!" dialog. By the time I hit Cancel on that dialog and hit Cmd+W again, the tab is perfectly happy to close.

I think that Zed should accept a command to close a tab for a file that is still saving. Either queue it up and wait for the file to save, or close the tab immediately and continue saving the file in the background.

You would perhaps not notice this defect if you have a super-fast disk, but I think it'll become more prevalent when things like Remote Development with networked filesystems are being looked at.

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

No response

adamsoutar avatar May 05 '23 15:05 adamsoutar

I think an easy way to reproduce this is:

  1. go to an unsaved buffer
  2. spam command + W a lot of times
  3. hit escape a bunch of times to dismiss all the "queued up" save dialogs (or save, it doesn't prevent more from coming up)

I run into this a lot 😅

abejfehr avatar Feb 28 '24 15:02 abejfehr

I still also hit this very often. I think it may be exacerbated by Format on Save combined with a slow formatter.

adamsoutar avatar Feb 28 '24 15:02 adamsoutar

Here's a recording of what this looks like in practice. After working on a feature, etc it's nice to close the open tabs (especially because Zed doesn't have ephemeral tabs, so there's many) and I spam command + W which inevitably asks me if I want to save my unsaved notes over and over

https://github.com/zed-industries/zed/assets/3917428/d25790c2-c37e-4d42-8594-452b8eefb43d

abejfehr avatar Feb 28 '24 19:02 abejfehr

Saving and opening files itself has become slow on Mac. Even with a single open file saving takes way too long and opening files is also taking too long. Around 5-6 seconds for saving file and same for opening a new file.

https://github.com/zed-industries/zed/assets/1749920/eece8f2a-e090-479f-a25d-c6cbdd6265e9

jerrythomas avatar Jun 05 '24 08:06 jerrythomas