我是Python新手,今天下载了程序。我试图打个招呼,但在运行和调试后遇到了这个问题:
缺少模块文档字符串 Pylint(C0114:missing-module-docstring)
所以在this问题@ikhvjs中据说他使用了这段代码。但我不知道我需要在哪里以及如何在用户设置的代码行中编写此代码。我试图在网上找到视频,但找不到。
"python.linting.pylintArgs": [
"--disable=missing-module-docstring",
"--disable=missing-class-docstring",
"--disable=missing-function-docstring"
]
我在 vscode 中的用户设置:
{
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"name": "One Dark italic",
"scope": [
"comment",
"entity.other.attribute-name",
"keyword",
"markup.underline.link",
"storage.modifier",
"storage.type",
"string.url",
"variable.language.super",
"variable.language.this"
],
"settings": {
"fontStyle": "italic"
}
},
{
"name": "One Dark italic reset",
"scope": [
"keyword.operator",
"keyword.other.type",
"storage.modifier.import",
"storage.modifier.package",
"storage.type.built-in",
"storage.type.function.arrow",
"storage.type.generic",
"storage.type.java",
"storage.type.primitive"
],
"settings": {
"fontStyle": ""
}
}
]
},
"liveServer.settings.donotShowInfoMsg": true,
"workbench.colorTheme": "Dark SynthWave '84",
"[python]": {
"editor.formatOnType": true
}
}
我尝试在“[python]”之后写这样的:
"[python]": {
"editor.formatOnType": true ,
"python.linting.pylintArgs": [
"--disable=missing-module-docstring",
"--disable=missing-class-docstring",
"--disable=missing-function-docstring"
]
}
}
但是没有成功。现在 vs 代码问题说“未知的编辑器配置设置”我如何禁用这个丢失的模块文档字符串?我需要卸载 pylint 吗?
无法应用此设置,因为它未注册为语言覆盖设置。
无法在语言中设置此设置。您可以将其添加到设置的末尾,如下所示:
"liveServer.settings.donotShowInfoMsg": true,
"workbench.colorTheme": "Dark SynthWave '84",
"[python]": {
"editor.formatOnType": true
},
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.linting.pylintArgs": [
"--disable=missing-module-docstring",
"--disable=missing-class-docstring",
"--disable=missing-function-docstring"
]
您可以打开
settings.json
文件夹下的.vscode
。
将这些代码添加到
settings.json
:
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--disable=missing-module-docstring",
"--disable=missing-class-docstring",
"--disable=missing-function-docstring"
]
另一种方法是尝试使用 Pylance 作为语言服务器:
"python.languageServer": "Pylance",
尝试在模块顶部添加文档字符串。 例子 ”“” 该模块提供了计算数字阶乘的函数。 ”“”