Demo, all content is generated
Question

ChatGPT gives back my whole file with '// rest of the code stays the same' in the middle

Solved · 722 views · asked by ahmed_elsayed · edited

I paste a 400 line component and ask for a change. It gives the file back but with // ... rest of your code unchanged ... in random places. When I copy it over my file, stuff is missing and the app breaks. Sometimes I don't notice for a day.

What I’ve tried

Asked 'give the full file without skipping'. It does, but then it gets cut off at the end.

Comment
This drove me crazy too. Git diff is the answer, learned it the hard way. kofi_mensah · edited

2 answers

Marked as helpful by the asker
bytebarista · edited

Raj's approach, plus: split the 400-line component. That's also why the AI struggles; smaller files mean smaller, complete answers.

And use git (even locally): after pasting, git diff shows immediately if 80 lines disappeared. That's the part that bites you a day later.

Comment
git diff after every paste already caught two deletions. Splitting the component next. ahmed_elsayed · edited
old_school_raj · edited

Stop asking for full files. Ask only for what changes:

Only show the functions you change, complete, with the function name as a heading. Don't return unchanged code.

Then paste those in yourself. Smaller answers, nothing gets silently dropped.

Comment
Better already, but I still sometimes paste in the wrong spot. ahmed_elsayed · edited