Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/configuration/config-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The following settings control pyright’s diagnostic output (warnings or errors

### Type Check Rule Overrides

The following settings allow more fine grained control over the **typeCheckingMode**. Unless otherwise specified, each diagnostic setting can specify a boolean value (`false` indicating that no error is generated and `true` indicating that an error is generated). Alternatively, a string value of `"none"`, `"hint"`, `"warning"`, `"information"`, or `"error"` can be used to specify the diagnostic level. [see above for more information](#diagnostic-categories)
The following settings allow more fine grained control over the **typeCheckingMode**. Unless otherwise specified, each diagnostic setting can specify a boolean value (`false` indicating that no error is generated and `true` indicating that an error is generated). Alternatively, a string value of `"none"`, `"hint"`, `"warning"`, `"information"`, or `"error"` can be used to specify the diagnostic level. [see above for more information](#diagnostic-categories), and check the [language server discouraged settings](./language-server-settings.md#discouraged-settings) to learn how to use them in your config (note that as the name implies, you should avoid doing that : use preferably the modes available for **typeCheckingMode**).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason they are discouraged isn't because typeCheckingMode is preferred, but rather because we recommend configuring these rules in pyproject.toml or pyrightconfig.json instead. the section you linked explains why:

these options can also be configured using a config file. it's recommended to use either a pyproject.toml or pyrightconfig.json file instead of the language server to configure type checking for the following reasons:

  • the config should be the same for everybody working on your project. you should commit the config file so that other contributors don't have to manually configure their language server to match yours.
  • it ensures that the basedpyright language server behaves the same as the basedpyright CLI, which is useful if you have your CI configured to type check your code (you should!)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh i think this addition should probably just be removed. makes the sentence a bit too long and it looks out of place to direct the reader's attention to something else, only to suggest not using it.


- <a name="reportGeneralTypeIssues"></a> **reportGeneralTypeIssues** [boolean or string, optional]: Generate or suppress diagnostics for general type inconsistencies, unsupported operations, argument/parameter mismatches, etc. This covers all of the basic type-checking rules not covered by other rules. It does not include syntax errors.

Expand Down
20 changes: 18 additions & 2 deletions docs/configuration/language-server-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ the basedpyright language server settings can be configured using a workspace or

```json title="./.vscode/settings.json"
{
"basedpyright.analysis.diagnosticMode": "openFilesOnly"
"basedpyright.analysis.diagnosticMode": "openFilesOnly",
"basedpyright.analysis.typeCheckingMode": "standard",
"basedpyright.analysis.diagnosticSeverityOverrides.reportCallIssue": "warning",
"basedpyright.analysis.diagnosticSeverityOverrides.reportArgumentType": "warning"
}
```

Expand All @@ -120,6 +123,11 @@ require("lspconfig").basedpyright.setup {
basedpyright = {
analysis = {
diagnosticMode = "openFilesOnly",
typeCheckingMode = "standard",
diagnosticSeverityOverrides = {
reportCallIssue = "warning",
reportArgumentType = false
},
inlayHints = {
callArgumentNames = true
}
Expand All @@ -138,6 +146,9 @@ args = ["--stdio"]

[language-server.basedpyright.config]
basedpyright.analysis.diagnosticMode = "openFilesOnly"
basedpyright.analysis.typeCheckingMode = "standard"
basedpyright.analysis.diagnosticSeverityOverrides.reportCallIssue = "warning"
basedpyright.analysis.diagnosticSeverityOverrides.reportArgumentType = false
```

### zed
Expand All @@ -156,7 +167,12 @@ basedpyright.analysis.diagnosticMode = "openFilesOnly"
"pythonPath": ".venv/bin/python"
},
"basedpyright.analysis": {
"diagnosticMode": "openFilesOnly"
"diagnosticMode": "openFilesOnly",
"typeCheckingMode": "standard",
"diagnosticSeverityOverrides": {
"reportCallIssue": "warning",
"reportArgumentType": false
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ load-plugins = [
disable = ["R", "C", "E", "F", "W", "I"]
enable = [
"useless-suppression",
"fatal",
# rules that have not yet been implemented in ruff. once all of these are implemented in ruff, we should remove pylint
# (see https://github.com/astral-sh/ruff/issues/970):
"access-member-before-definition",
Expand Down