-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zed is caching files? #20872
Comments
Seeing the same behaviour, in a |
Can you provide explicit steps to reproduce? Are you saving the file in VSCode? |
Sure, I'll try to prepare exact steps to reproduce with sample data. |
In my case it was a separate script modifying the JSON, that I had open in Zed to monitor/change manually if needed. I've just tried to write a simple script now to simulate this, but I'm not able to reproduce the exact behaviour, I'm not seeing it currently. The file is similar in size by making a minimum 3000 entries. Ramping the number up to 30000 entries doesn't seem to make a difference. Anyway here's the script to give you an idea, just in case it's a starting point. import json
import random
import string
from pathlib import Path
FIRST_NAMES = ['Emma', 'Liam', 'Olivia', 'Noah', 'Ava', 'Ethan', 'Sophia', 'Mason', 'Isabella', 'William']
LAST_NAMES = ['Smith', 'Johnson', 'Williams', 'Brown', 'Jones', 'Garcia', 'Miller', 'Davis', 'Rodriguez', 'Martinez']
DEPARTMENTS = ['science', 'math', 'history', 'english', 'art']
def generate_random_id():
return f"{random.choice(DEPARTMENTS)}_{random.choice(LAST_NAMES).lower()}_{random.randint(1000, 9999)}"
def generate_entry():
first_name = random.choice(FIRST_NAMES)
last_name = random.choice(LAST_NAMES)
dept = random.choice(DEPARTMENTS)
return {
"name": f"{first_name} {last_name}",
"class": dept,
"email": f"{first_name.lower()}.{last_name.lower()}@school.edu",
"group": f"group_{random.randint(1, 5)}",
"status": random.choice(['active', 'inactive', 'pending'])
}
def generate_test_data(filename='test_data.json'):
data = {}
if Path(filename).exists():
with open(filename, 'r') as f:
data = json.load(f)
current_count = len(data)
if current_count < 3000:
entries_to_add = 3000 - current_count
else:
entries_to_add = random.randint(5, 25)
for _ in range(entries_to_add):
student_id = generate_random_id()
while student_id in data: # Ensure unique ID
student_id = generate_random_id()
data[student_id] = generate_entry()
with open(filename, 'w') as f:
json.dump(data, f, indent=2)
return len(data)
if __name__ == "__main__":
final_count = generate_test_data()
print(f"Test data generated. Total entries: {final_count}") |
If you manage to trigger this behavior again, please see if there's anything of note in the Zed logs. Pure speculation, but I wonder if there's a race condition where Zed gets notified of a change but before we can read the filename is replaced again. As a result Zed falls into an error state when it stops watching. (pure speculation). I'd be curious whether closing and reopning the tab (cmd-w, cmd-shift-t) brings things back to normal. Anyways, would love something reproducible so we can dig deeper. |
Check for existing issues
Describe the bug / provide steps to reproduce it
I'm using VSCode & Zed at the same time. Testing it hand by hand. It seems Zed is caching files aggressively.
foo.json
in both VSCode and Zed at the same time.It's not reproducible in small files. The file I was working on was 30MB big json file. So I'm assuming file size may has something to do with it.
Environment
Zed: v0.162.2 (Zed Preview)
OS: macOS 15.1.0
Memory: 16 GiB
Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
Zed.log
The text was updated successfully, but these errors were encountered: