-
Notifications
You must be signed in to change notification settings - Fork 767
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
Pylance is linting standard library and venv site-packages #1514
Comments
by default pylance should only be returning diagnostics for "opened" files. can you confirm you haven't set this setting to something besides settings.json
|
It also shouldn't show those files even in workspace diagnostics mode, so long as that interpreter is selected. |
This has been reproduced with both diagnostic modes. |
The log shows that I'm unable to reconcile the screen shot above with the provided logs. In particular, the files displayed in the "Problems" section in the screen shot are not mentioned in the log, which means that pylance has not opened or analyzed those files. For example, |
I noticed, but some are, such as |
What's also been observed is that this doesn't happen immediately, or always happens even. When it does happen it's frequently 10-15min after the project had been opened. |
Do you remember ever opening these files in the editor? Also, could you please answer the question asked by @bschnurr above? Is "python.analysis.diagnosticMode" set to the default value of "openFilesOnly", or have you changed it to "workspace"? |
Doing a "Go to definition" on a method reference when The easiest way to reproduce this is to "Go to Definition" on |
Thanks for the info. The errors being retained on file close is the bug, but I can't seem to reproduce it on my machine using any of my available interpreters. Closing the open file always hides the diagnostics, so I don't know what's going on there. (Sounds similar in behavior to #1404, but that's triggered by some yet-to-be-known behavior.) |
On systems with slower harddrives or especially aggressive AV on-demand scanners this behavior also will trigger heavy bottlenecking of harddisk or CPU respectively. |
I don't see how any of this has anything to do with performance. We will only analyze the files when they are opened or changed; the stdlib is stubbed, so we don't analyze the files that are in your screenshots unless they are explicitly opened, and the stdlib doesn't change, so we won't do any more work than we are required to do. |
I think @erictraut figured this out and fixed it in microsoft/pyright@d01295d, but we can see in today's release. |
This issue has been fixed in version 2021.7.3, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202173-14-july-2021 |
I am working on identifying the reproduction workflow but it looks like this issue or a variant of it has regressed on my instance. |
I was going to comment that I too have been having this issue( running VS code with a miniconda venv on WSL2 ) for a couple of months. See example picture: My workaround had been to switch to the Jedi language server. On further trying today, it was the |
Unfortunately "python.analysis.diagnosticMode": "openFilesOnly" isn't a valid workaround. If you're entire project is error free setting it to |
Environment data
Expected behaviour
Only the current workspace, excluding site-packages should be linted for issues.
Actual behaviour
Pylance is linting the standard library and venv site-packages
Logs
pylance log.txt
The text was updated successfully, but these errors were encountered: