4

When Pylance was introduced, I filed a question on how to generally customize Pylance linting. Here, one can find a few ways to customize Pylance, but there is nothing about how to suppress, mute or actually disable certain warnings and errors.

As a recap, with pylint one can specify the following in VS Code settings.json to disable a certain error/warning:

"python.linting.pylintArgs": [
    "--disable=C0111"
]

As for the background, since the excessive Pylance(reportMissingImports) linting errors has not been resolved yet and due to project requirements, I've enabled pylint simultaneously with Pylance. Still, these countless Pylance(reportMissingImports) linting errors are annoying and I'd like to silence them completely.

Andreas L.
  • 1,812
  • 1
  • 13
  • 38

1 Answers1

14
  1. Get error-message value you want to modify/disable here (in my case "reportMissingImports")
  2. Modify settings.json with "reportMissingImports": "none" (see diagnosis reporting levels here)

The entire code to be inserted into the settings.json is:

"python.analysis.diagnosticSeverityOverrides": {
    "reportMissingImports": "none"
}

As an aside, if you want to be at least informed about unused imports, you can insert:

"python.analysis.diagnosticSeverityOverrides": {
    "reportUnusedImport": "information",
    "reportMissingImports": "none"
}
Andreas L.
  • 1,812
  • 1
  • 13
  • 38