Ignore Pylance missing imports
Asked Answered
B

2

8

I'm trying to modify my settings.json file for VSCode to ignore missing imports for my own scripts. As i've learnt I have to set "python.analysis.useImportHeuristic" to true. Code says it is an unknown configuration setting but as long as I've searched I haven't seen any info about it. What am I missing?

enter image description here

Bede answered 28/7, 2022 at 0:5 Comment(0)
T
13

insert this:

# type: ignore

paste it at the top of the file to ignore the file

paste it at the end of a line to ignore the line

Reference: https://www.reddit.com/r/VisualStudioCode/comments/i3mpct/comment/g5bkx9u/

Telethon answered 19/8, 2022 at 5:15 Comment(1)
this also ignores the line for mypy which actually does a better job than pylance and will correctly complain about the type ignore because it is useless. is there a pylance specific ignore?Mouflon
O
10

Add this to your settings.json:

"python.analysis.diagnosticSeverityOverrides": {
    "reportMissingImports": "none"
}
Oe answered 15/6, 2023 at 11:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.