zed icon indicating copy to clipboard operation
zed copied to clipboard

Diff indicators not restored when reopening remote project

Open feeiyu opened this issue 9 months ago • 4 comments

Summary

When working with a remote project in Zed, the diff indicators (change markers) fail to reappear under specific circumstances:

  1. Open a remote project and edit a file, the diff indicators correctly appear in the gutter.
  2. Close the remote project and reopen again.
  3. The previously opened tabs with uncommitted changes are restored, but the diff indicators are missing in the gutter.

Expected Behavior: Diff indicators should restored and remain visible. Actual Behavior: The visual diff indicators in the gutter disappear, and must manually reopen file to restore them.

https://github.com/user-attachments/assets/4c8462ed-c466-42d8-8f78-661d58867ca4

Zed Version and System Specs

Zed: v0.186.9 (Zed) OS: macOS 12.7.3 Memory: 8 GiB Architecture: x86_64

feeiyu avatar May 18 '25 14:05 feeiyu

After digging deeper, here's what I found:
When Zed reopens the remote project and restores files, it tries to get the "uncommitted changes" from the Repository. The Repository will create after Zed gets a proto::UpdateRepository message from the remote server.

Sometimes, the server takes a tiny bit longer to send that message. So, Zed ends up restoring the files first and creating the Repository later. By then, the diff check has already tried (and failed) to find the Repository, leaving those change markers invisible.

feeiyu avatar May 18 '25 15:05 feeiyu

I have encountered the same problem too. Did you find any workaround?

eastonman avatar May 22 '25 13:05 eastonman

@eastonman one workaround I use (which is not really a workaround) is to delete the remote project and reopen it, then go over the hassle of reopening each of the files you were working on. Quite frustrating, but it does get Git indicators back in the gutter.

scorphus avatar May 23 '25 12:05 scorphus

I found that I don't have to delete the remote project to restore the diff indicator. Just close all the files opened and open them manually again will fix the problem.

I am using version 0.187.6, and this bug still exists. Just left a comment here in case somebody can't upgrade to latest version.

eastonman avatar May 26 '25 07:05 eastonman

I have encountered the same problem too. Did you find any workaround?

Workaround: If you encounter this issue and have multiple files with Git changes, a temporary workaround is to close the remote workspace window (without quitting the Zed application) and then reconnect to the same remote session from within Zed. This typically restores the visual indicators for Git changes and makes them visible again.

suogisushi1911 avatar Jun 10 '25 07:06 suogisushi1911