-
Notifications
You must be signed in to change notification settings - Fork 771
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 preferences pyproject tool.pyright over workspace settings #5969
Comments
Here is a full project that is able to reproduce the issue attached |
Yes, pyright settings in the config file (pyproject.toml or pyrightconfig.json) override workspace (language server) settings. This is very much by design, and it would be problematic if we were to change this. Config files are typically committed to the repo, and these settings are common to all developers working on the project. It wouldn't make sense to allow each developer to override these settings because this would result in inconsistent type checking behaviors from one developer to the next. It sounds like you want the ability to tell pylance that it should index only a subset of your project. Is that correct? Why don't you want it to index your full project? |
This doesn't seem to be documented though and was incredibly surprising.
Yes, correct. Our repo has approximately 60,000 python files. Different teams operate in vastly different areas of the code base. Having pylance index the entire repo results in large memory use and requires us to restart it several times per day. To combat this, devs (were trying to) customise their own workspace settings to only index the subset of files they interact with. We don't use pyright for typechecking (we use mypy instead) - pylance is used for refactoring/code nav/reference finding etc. From memory, the only reason we added a section into the |
Thanks for your feedback. As mentioned earlier, this behavior is by design, and we currently do not have plans to change it in the near term. However, we value user input and will monitor feedback closely. If we receive more requests like this, we will certainly consider making changes. For now, we are closing this issue. Thanks. |
The issue here is that pylance prioritises the pyproject.toml settings for
tool.pyright
over the vscode workspace settings. This is problematic because excluding/including the bare minimum in the pyproject.toml file applies to all editors. We should be able to selectively override what this session/workspace wants to index.Environment data
Code Snippet
Repro Steps
Open the workspace with Trace enabled. Note that pylance is indexing all files under
src/
including files under/migrations/
.Expected behavior
Only the files listed under
python.analysis.include
are indexed, and all files undermigrations
are excluded.Actual behavior
Pylance honours the settings of the
pyproject.toml
over the workspace settings, indexing all files undersrc/
except forsrc/project/exclude.py
Logs
The text was updated successfully, but these errors were encountered: