Cursor Pyright fails to suggest imports if the file hasnt been opened in the session.
This has been reported multiple times.
The issue has been fixed on basedpyright v1.39.6 (pyright 1.1.410) so i am requesting you guys to update cursor pyright fork which is a fork form basedpyright.
Steps to Reproduce
Open a python file.
Type the classname/function that exists on another file within the workspace that hasnt been opened yet.
It will show “xxx not defined.” click code actions. → no suggestion to import from the file it exists
Hey, thanks for the detailed report, and for linking the upstream PR and issue. That really helps.
Confirmed: cursor-pyright is a fork of basedpyright, and the version in Cursor is currently behind the one that includes the fix PR #1802 in v1.39.6. I’ve passed this to the team that owns extensions, they should do a new rebase. I can’t share an ETA for the update yet.
Until it’s fixed, the most stable workaround is to open the source file in the editor once, even just click it in the Explorer. After that, auto import suggestions start working for the current session. Not perfect, but it helps until the bump.
If there’s an update on the version, I’ll post it in this thread.
Hey @Joao_Marcelo, quick update on this thread. There have been some changes in this area, can you check on the latest stable (v3.7)? Quick check using your own repro:
Open a workspace with multiple Python files.
In one file, start typing a class or function name from a module you haven’t opened in this session yet.
Check if an auto-import suggestion now shows up in Code Actions.
Let me know if the issue with missing auto-imports for unopened files is still there. If you can still repro it, tell us and we’ll dig in further.