Python syntax highlighting fails for some syntax

Hello, I recently started using Cursor and noticed that some syntax highlighting is not present for certain syntax such as constants and the module part of the import statement. I can still ctrl+click the modules/constants, so they are still recognized and interactable, just not highlighted. I have Python+PyLance installed in both VS-Code and Cursor and am remote ssh’ed into a server.

I have the same problem. Doesn’t seem to be an issue with some other themes but the Dark+ theme has this issue.

Correction, it even impacts the default theme:

In the pic below, the first line is an existing line as you open the file and the second line is one that’s added. No reason they shouldn’t have the same highlighting.

image

Python language server output showing failure to determine token delta.

OK, here’s how I fixed it. Something strange is going on, but this seems to work.

  1. Remove ALL extensions
  2. Create a new user on your system with admin role
  3. Log in as that user
  4. Install cursor with no plugins and no VSC link
  5. Install python which will give you: Python, Pylance, Python Debugger
  6. Go into the .cursor folder of that user and the extensions folder. Delete everything from the extensions folder of the original user and copy all files from the new users.
  7. Log back in from the original user and it should now work.

Now I’m a little suspicious here. When I tried to install Pylance from the VSC marketplace website, downloading the VSIX file, it refused to load as it detected that it’s not VSCode.

For some reason the version that installs when you install Python, appears to be patched, allowing you to run it even though it’s not being run in VSCode. Note that you cannot find it by searching extensions within the app. But if you copy the files from a new install, they do work.

Feel like there should be a better way of installing this automatically.

Unfortunately, this doesn’t work for me, I’m using Windows 11 :sob: