Cursor re-writes the whole code from scratch at the bottom of the code

Hello,

This has been happening a lot lately.

Cursor procceeds on making the changes it’s supposed to and then it keeps re-writing the whole code from the beginning, at the bottom of the new code. You can see an example at the image above.

6 Likes

Thank you for the report. We’ll have a look.

3 Likes

Is this with GPT-4 or GPT-3.5?

1 Like

It’s with GPT4, I managed to find a workaround, I noticed that this is happening because the answer that I get it is not very specific as to where exactly to make the changes in the code (it has many “…” comments confusing the model as to where exactly to make the changes. (when code is more than 400 lines). So if I give it a prompt like this :

“please respond again but understand where exactly you put these “…” because the way you put them you can’t really understand in which line they are being put and what to skip and when you want to enter the code you get confused as to where exactly to put it and what to skip. please be more specific in your response and answer again !”

Then it responds in snippets like that :

I apologize for the confusion. Here’s a more detailed breakdown of the changes:

  1. Update the itemsPerPage constant to 7:
    (solution…)

  2. Add the handleNext and handlePrevious functions:
    (solution…)

  3. Update the FlatList component in the return statement of AddPartsUnified:

(solution…)

this way it does not lose navigation as to where to make the changes and most of the time it works pretty well

1 Like

I know it’s been some time since this topic was created but I have the same issue using Sonnet 3.5 and 3-opus. Any updates on the fix for that?
Here is how exactly does it look on my end: https://www.youtube.com/watch?si=onAFcFetVFUd7GFU&v=Kqdg33zcdPE&feature=youtu.be
I’ve checked it on my MacBook and the issue is gone. Perhaps it’s just a windows bug?

No, this also happens on my Mac. Not just a windows bug. I think it has more to do with the models getting confused with the larger files.

1 Like

Same here on Windows, and its not just sonnet it’s all models for me, updated recently in the past day or two

2 Likes

Same issue for me from yesterday with all models. Abruptly stops editing and duplicates all code below where it stopped edit.

4 Likes

@Jakob are you guys aware of this? :thinking:

1 Like

Try to have the file open in editor and then select (highlight) the specific function or section of code you want to edit. Composer should then reference the file as well as the specific location inside that file and hopefully that should clear it up. I use this as the “composer ctrl+K” inline edit of sorts.

Apologies if you’ve tried this already, hard to tell where everyone is at individually these days haha.

1 Like

It is the Same Issue I am Facing Today, For The Large File Changes are Being Duplicated Instead of Making Changes to the Existing Ones

1 Like

I’m also running into this consistently starting today. using claude 3.5

1 Like

yeah weird, this just started happening yesterday for me.

1 Like

I’ve got the same issue yesterday using Claude 3.5

1 Like

Same issue here, happens on either models or macOS/Windows. Started around like 2 days ago.

1 Like

Getting a similar problem on Claude 3.5, output in composer contains repeated blocks of code.

1 Like

I also encountered the same problem
I suspected that the file was too large, so I asked cursor to split the file into multiple files, and then cursor worked normally.

1 Like