microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.71k stars 767 forks source link

Virtual envs in the workspace are treated as user source #5169

Open rchiodo opened 10 months ago

rchiodo commented 10 months ago

I have a workspace folder like so:

When opening the folder, it analyzes the files in the venv that isn't currently selected as if they were user files. I end up with a situation like so:

image

Exclude paths don't seem to fix the issue either. I tried this:

"python.analysis.exclude": ["venv1", "venv2"]

Additionally our help says all virtual environments are excluded automatically:

image

rchiodo commented 10 months ago

Turns out I had a workspace settings.json that listed just this:

"python.analysis.exclude": ["test_packages"]

This eliminated the defaults that skip virtual environments. If I remove that exclusion, then the virtual environments are excluded.

rchiodo commented 10 months ago

Perhaps the virtual environments could somehow be a separate setting? Not sure if this really matters anymore.

rchiodo commented 10 months ago

If the default listed out the default options, then this likely wouldn't have been an issue. Something like how the excludes for files does in VS code when you edit it:

    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    }
cwebster-99 commented 1 month ago

@rchiodo I thought this might have been resolved, does this problem still exist?

rchiodo commented 1 month ago

No this still reproduces. It's kind of a problem. I think we should change it to always exclude venv enviroments.