I’m experiencing an issue with the Cursor editor. When using AI assistance to generate code changes, the AI writes the correct code specific to my intended file, but these changes are not actually being applied to the file in question.
For instance, I’ve been working on updating some JavaScript in an index.html file, and while the AI provides updated code snippets, they don’t end up reflected in the file itself after the chat. I’ve attached screenshots of the generated code and the settings I am using.
I don’t know if this issue has been solved before, so apologies in advance if it’s a common topic.
Has anyone encountered similar behavior or know how to ensure the changes are properly applied? Any help would be appreciated.
Yes, when it lets me. To click “Accept”, the code needs to be generated in the chat, and then you need to click “apply” to that file. But when clicking “apply” - as seen in the image:
There is no file to apply it to, therefore it becomes impossible to click “Accept”.
what makes this really problematic for me is that you are using your limited requests to the model, and then you can not apply it to the code. Essentially wasting requests.
Where did the file go? Did you delete it? And you want it to apply changes to a file that doesn’t exist? If you created a new one, just copy and paste the changes there. I also recommend starting a new chat since the old one still thinks the file is there.
I was working in a specific file (the file was not deleted), using the chat to generate a solution to a problem. While the solution was correctly generated, I wasn’t able to apply the code changes directly to the file from the chat. It seems the generated solution wasn’t properly linked to the file I was actively editing. It has been working correctly these few hours, might be a random bug, but it did persist for some time when it happened.
Same here, had the same issue. You need to start anew Composer session.
Just copy the last conversation you had (somewhere in a text), and then give the context in the new session.
We are interacting through an AI-driven IDE interface that enables a small local model to read your outputs and apply necessary edits to specific files. Therefore, it is essential to follow the instructions regarding the expected output format precisely.
Include a small excerpt from the current file before and after the intended changes. This allows the local model to pinpoint where modifications or additions should be made.
Example:
.```
// ... Previous content remains unchanged
{excerpt; 2 or 3 lines of the existing content immediately before the intended change}
{intended addition or modification}
{excerpt; 2 or 3 lines of the existing content immediately after the intended change}
// ... Following content remains unchanged
.```
Note: The comment format must start with '// ...'
After pasting it, remove the dot from ‘.```’ in the open and close.