Skip to content
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

extraPaths in executionEnvironments extends the default extraPaths instead of overriding them #9636

Open
FairySunny opened this issue Dec 28, 2024 · 1 comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@FairySunny
Copy link

Describe the bug

extraPaths in executionEnvironments extends the default extraPaths instead of overriding them.

I use VS Code (Code OSS) with the pyright extension of version 1.1.391 to open a project with the following directory structure and pyrightconfig.json:

extra1/
  lib0.py
  lib1.py
extra2/
  lib0.py
  lib2.py
sub/
  subtest.py
test.py
pyrightconfig.json
{
    "extraPaths": ["extra1"],
    "executionEnvironments": [
        {
            "root": "sub",
            "extraPaths": ["extra2"]
        }
    ]
}

In test.py, pyright works as expected. import lib1 and import lib0 is ok while import lib2 results in an error, and the imported lib0 is the module under extra1.

In sub/subtest.py, pyright does not work as described in the documentation. import lib2 is ok, but import lib1 is also ok and import lib0 imports the module under extra1 instead of extra2. The documentation of extraPaths in executionEnvironments says, 'If specified, this overrides the default extraPaths setting when resolving imports for files within this execution environment.' However, the actual behavior of extraPaths is extending the default extraPaths instead of overriding them.

VS Code extension or command-line

VS Code extension (VS Code OSS on Linux), version 1.1.391.

@FairySunny FairySunny added the bug Something isn't working label Dec 28, 2024
erictraut added a commit that referenced this issue Dec 28, 2024
…n an execution extending rather than overriding the `extraPaths` provided in the top-level config. This addresses #9636.
erictraut added a commit that referenced this issue Dec 28, 2024
…n an execution extending rather than overriding the `extraPaths` provided in the top-level config. This addresses #9636. (#9639)
@erictraut
Copy link
Collaborator

Thanks for the bug report and the detailed repro steps. Your analysis was correct.

This will be addressed in the next release.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants