gpt4 book ai didi

python - 是否可以设置 lint 自定义设置并忽略 pylance

转载 作者:行者123 更新时间:2023-12-05 08:49:09 34 4
gpt4 key购买 nike

以前在使用 pylint 时,我使用自定义注释设置在 vscode 中编辑时忽略 undefined variable ,例如:

# Make pylint think that it knows about additional builtins
data = data # pylint:disable=invalid-name,used-before-assignment,undefined-variable
DEBUG = DEBUG # pylint:disable=invalid-name,used-before-assignment,undefined-variable
VERBOSE = VERBOSE # pylint:disable=invalid-name,used-before-assignment,undefined-variable

注意我的应用程序有它自己的基于 python 的精简脚本语言,因此有额外的内置函数。

我一直没能找到 pylance 的等价物。有人有什么建议吗?

最佳答案

您可以在settings.json 配置文件中添加以下设置:

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

或者您可以在设置中搜索python.analysis.diagnosticSeverityOverrides,点击Add Item按钮选择“reportUndefinedVariable”,“”:

enter image description here

结果:

enter image description here

关于python - 是否可以设置 lint 自定义设置并忽略 pylance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64649795/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com