Singe quote added in code comment causing issues

Hi,

I found that sometimes a ’ is added in code comments, but this also breaks the code elsewhere as I get syntax errors, so I think it doesn’t evaluate it as a comment and then writes the code wrong.
Schermafbeelding 2025-02-08 085934

Windows 11.

:white_check_mark: Check the forum to ensure the issue hasn’t been reported already
:lady_beetle: Provide a clear description of the bug
:arrows_counterclockwise: Explain how to reproduce the bug (if known)
:camera: Attach screenshots or recordings (e.g., .jpg, .png, .mp4).
:computer: Tell us your operating system and your Cursor version (e.g., Windows, 0.x.x).
:no_entry_sign: Tell us if the issue stops you from using Cursor.

Hey, are you sure you don’t have any other syntax errors? I just checked your code, and as you can see, everything is okay.

Perhaps it was a coincidence indeed, but I’m currently having a situation were it mentions about a syntax error in the code: (syntax error, unexpected token “class”, expecting “)” but it’s not able to resolve it, when there is a syntax error sending a message in the composer doesn’t send the message to any model it seems, as none of the AI models reply, it stays in generating mode without reply. Tried the quick fix option in the code which tries a fix but doesn’t resolve the issue.

Any advise on how to deal with such cases? I also copied the code lines from the affected file to another composer (agent mode) and it tries to fix certain things, however it won’t find the issue and syntax errors appear elsewhere in the code.

Update: I copied the snippet to O1 and it came back with some options to resolve it, in my case it said the issue was: when you wrap JavaScript code inside a single‐quoted PHP string, any single quotes inside that JS must be escaped—or else PHP thinks you are ending the string prematurely.

It then provided a new snippet which I copied in the code and then saved, which resolved the issue.

But it seems cursor couldn’t find the issue directly.