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

Rules overrides are not recognised #4551

Closed
Andy-Dihong-Luo opened this issue Jun 28, 2023 · 2 comments
Closed

Rules overrides are not recognised #4551

Andy-Dihong-Luo opened this issue Jun 28, 2023 · 2 comments
Assignees

Comments

@Andy-Dihong-Luo
Copy link

I use Pylance in the "basic" diagnostic mode and want to enable the strictListInference rule. I have the code below in my settings.

"python.analysis.typeCheckingMode": "basic",
"python.analysis.diagnosticSeverityOverrides": {
    "strictListInference": true
}

However, when I type [0, 'a'] e.g., Pylance still hints the list to be List[Unknown]. Expected to List[int | str]. Did I make something wrong?

@heejaechang
Copy link
Contributor

Can you provide us some logs as described in the troubleshooting guide?

@heejaechang
Copy link
Contributor

by the way, you can't set strictListInference in setting.json. you need to use either pyrightconfig.json or pyproject.toml to set it. see https://github.com/microsoft/pyright/blob/main/docs/configuration.md for more detail.

...

I just set json at the root of workspace folder and can see it works as expected.

{
    "strictListInference": true
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants