Since installing the Python (Pyright) extension from the Cursor team, me and my colleague have a problem.
Sometimes, after working for long in the same session, the Cursor IDE will start to analyze files, but these files will never complete analyzing. Whenever this happens, coloring the code and type checks will be slower.
Seems to b a problem with the type checking, as I don’t have this when I remove the Cursor Pyright extension. This is not present with the native Microsoft extension.
Hi @Jxlle, thanks for sharing this issue. Could you confirm which Python extension and version you’re on (could you share a screenshot of it?). This is the one we recommend:
If it takes a while to index, it might help to add exclude directories (or set include directories) to limit the # of files being indexed. These can be configured in the settings:
Hi @Jxlle, thanks for confirming. Does ctrl-click (jump to definition) work?
If so, then it might be an issue with the type check settings, which would affect the colorization. The default is “off” which hides many errors. You might need to be set to “basic” (or a stricter level):
Otherwise, could you share the logs from the “Cursor Pyright” and “basedpyright” output windows? These would be helpful to understand whether the LSP is crashing. Thanks!
Hi all – thanks for confirming; we are looking into this issue. In the meantime, if you would like to use the VSCode plugin, please first uninstall Python by Anysphere, and then search for “Pylance” and install that. Attaching a screenshot.
I had switched back to the “regular” Python extension due to this issue. Still, today I got a notification saying that Python (Anysphere) was installed and I should uninstall the other extension for it to work properly. I thought that it may have been fixed since Cursor reinstalled the Anysphere version automatically, but no luck, still looking here at “218 files to analyze”.
Also, does anyone have any tips on how to get the Ruff extension working with Python by Anysphere? Is the expected working method to have installed Python (by MS), Python (by Anysphere) but not Pylance or should I just have just the Python (Anysphere) installed? It’s a bit confusing.
Hi @wolfnuyts-reform and @vinismarques, we are still looking into this issue. Our suspicion is that the language server is choking because of dependencies – we’ve seen some posts about Pydantic specifically potentially causing issues. Please also double check that the language server is set to None – this should be done automatically, but could cause errors if the Jedi language server activates.
@vinismarques – yes, you can install just the ms-python.python extension (which is what is required by Ruff). The Anysphere Python (anysphere.cursorpyright) will automatically be installed too, but then you can remove ours to just use Ruff + MS Python.
Thanks for the update @ravirahman! I am indeed using Pydantic, but no idea what is going on exactly. I did try restarting the Python server, and it reanalyzes some files, but the number that was stuck there remains stuck.
Example: I had 3 files stuck at analyzing, so I restarted the server, and it increased to seven and came down to 3 after a few seconds. It seems that other files were analyzed fine, but those 3 remained stuck.
I really think that Cursor should just delete the Pylance and Cursor Python / basedpyright-fork that they have put in the extensions list. Both had major problems and crashed frequently in our codebase. I have switched to basedpyright directly and it seems to work well as-of-now.
@vinismarques The Cursor extension changes the BasedPyright extension in a way that it looks and behaves more like Pylance. Pylance, the closed source version of Pyright from Microsoft, is blocked (the newer versions at least) on VSCode forks.
Pyright, the open source version, lacks some features of Pylance (such as the 5 type checking levels, there are less in Pyright).
BasedPyright, a Pyright fork, adds some Pylance features, but is less user friendly as it enforces a certain type checking style / level.
So basically, the Cursor extension is a replacement for the closed source Pylance from what I know so far.
Hey @ravirahman I found out that it was fixed upstream in pyright, and basedpyright has the fix in their 1.29.2 release. Currently the latest version is 1.29.4, but the issue is that I can’t find these in the Cursor extensions, even though it does appear in VSCode. In Cursor, the latest available is 1.29.0.
Hi @vinismarques, thanks for finding this. We are working on rebasing the latest stable version of basedpyright into our extension and will ship an update for it. It’s currently a manual process, though hope to make it more automated in the future.
We released Version 1.0.4 of Cursor Python which is available as a pre-release version. The new version uses basedpyright version v1.29.4. It’s available as a pre-release version, which you can get by clicking the “Switch to Pre-Release Version” under the extension page:
How can I download the pre-release version?
Is it not available on Windows yet?
I tried checking from version 1.0.3, but I can’t find a button to switch to it.