microsoft / pyright

Static Type Checker for Python
Other
13.12k stars 1.4k forks source link

I cannot disable type checker in pyright@1.1.376 #8813

Closed zhou13 closed 3 weeks ago

zhou13 commented 3 weeks ago

Describe the bug I cannot disable type check in pyright@1.1.376. The following config works fine in pyright@1.1.375: python.analysis.typeCheckingMode is set to off.

Code or Screenshots If possible, provide a minimal, self-contained code sample (surrounded by triple back ticks) to demonstrate the issue. The code should define or import all referenced symbols.

In pyright@1.1.376 and when python.analysis.typeCheckingMode is set to off, typechecking is still not disabled:

Screenshot 2024-08-22 at 11 58 43 PM

VS Code extension or command-line Are you running pyright as a VS Code extension, a language server in another editor, integrated into Pylance, or the command-line tool? Which version?

I am using nvim lspconfig. The problem only happenes in pyright@1.1.376 and later, not in pyright@1.1.375.

erictraut commented 3 weeks ago

I presume that you have a pyrightconfig.json config file or a pyproject.toml file with a "[tool.pyright]" section in it. When a config file is present, any settings that affect type checking (whether explicit or default) take precedence over LSP settings. The assumption is that when you've defined a config file, you want type checking settings that are consistent for all collaborators on the project. This change was made recently, which is why you're seeing this behavior in 1.1.376 and later.

If you want to adjust the type checking settings for your project, you can make the change in your config file. Or if you don't want your config file to take precedence, you can delete the pyrightconfig.json file or the "[tool.pyright]" section of your pyproject.toml file.