-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sourcery plugin in VSCode uses too much process #405
Comments
Hello, @PhunkyBob! Thanks for reporting this issue. This is definitely a strange bug. If I understand correctly:
Is this correct? If so, can you please send your Sourcery log file to [email protected]? |
Not every script.
Yes. Sometimes it scans files that are not opened in my IDE. Log file has been sent by email. |
Thank you for your reply and for sending your log file, @PhunkyBob! |
I've been tracking this issue since it was closed by the original poster (in my opinion unresolved) over in sourcery-ai/sourcery-vscode#150. I believe that the identified root cause is correct, that Pylance and Sourcery are not playing nicely together. However, the conclusion seems to be that it's not Sourcery's responsibility (or was understandably not top priority at the time), since these files are being opened by Pylance and thus triggering the re-scanning. I suspect that Pylance+Sourcery is not an entirely uncommon combination, so maybe this issue can be revisited (either here or in the VSCode extension repo)? I think the conclusion reached in sourcery-ai/sourcery-vscode#150 is not quite right, because lots of these pending Sourcery scans get banished in a limbo state, never actually completing their scan because perhaps there is no file left to scan. I believe Pylance creates ad-hoc temporary files when scanning, especially with Jupyter notebooks it creates temporary Python scripts per-cell and scans those to report on notebook contents. I imagine that the temporary files are necessitated by some limitation I'm not aware of. I suspect the solution options might look like the following:
Some contact with the Pylance team might help chase this problem down. Here are some quoted snippets from the earlier issue for some more context:
I've configured my |
Sometimes, I create a new file ("Untitled 1") and I quickly save it as "[something].py". But I see in the Sourcery window a loop in scanning "Untitled 1". |
Checklist
Description
In VSCode, Sourcery is always scanning my code, even if I don't touch it.
It uses a lot of processor time.
So much process that the others features of the IDE are not working well (Pylance, ...).
Sometimes I type a variable and my IDE takes 10 seconds to understand that the variable exists!
If I look in the VSCode notification, I can see Sourcery is scanning 10 times the same file.
Code snippet that reproduces issue
No particular code.
It do so on every Python script.
Debug Information
IDE Version:
VSCode
Version: 1.84.2 (user setup)
Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
Date: 2023-11-09T10:51:52.184Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045
Sourcery Version:
v1.14.0
Operating system and Version:
Windows 10
The text was updated successfully, but these errors were encountered: