support multiple config files in the language server
original issue: https://github.com/microsoft/pyright/issues/8019
Is your feature request related to a problem? Please describe.
thanks for adding the extends option! however for my use case i would like to be able to run pyright once in the root of my project and have it automatically type check each file with their correct pyrightconfig.json file.
for example, if i have the following project structure:
.
└── project/
├── foo/
│ └── pyrightconfig.json (extends the top level pyrightconfig.json)
├── bar/
│ └── pyrightconfig.json (extends the top level pyrightconfig.json)
└── pyrightconfig.json
and i run pyright in the project root, it seems to typecheck every file with the top-level pyrightconfig.json file. so instead, i have to run it several times for each config file:
pyright -p foo/pyrightconfig.json
pyright -p bar/pyrightconfig.json
this isn't a big deal. typescript behaves the same way, and i can set up the CI to run both commands. however unlike typescript, this feature doesn't seem to work well with vscode, because the pyright/pylance extensions only look at one config file for the whole project, meaning it shows incorrect errors on the files in the foo and bar folders because vscode is type checking them with the wrong config file.
Describe the solution you’d like
when not specifying a config file explicitly with --project argument, the language server should look for the closest pyrightconfig.json file (or pyproject.toml) relative to each file it checks, rather than using the same top-level config file for each one.
closing this in favor of #307, as that feature was added upstream and i don't think it makes sense to support 2 different ways to do the same thing
actually i think this should be supported, since executionEnvironments has a different use case (see #668) and they don't support the use case of having different excludes (like the example in #1264)