作者:sbn3552505 | 来源:互联网 | 2022-12-06 14:01
我最近切换到了Visual Studio Code,到目前为止,我不得不说我喜欢它。
我正在研究一个Python项目,其中包括pip程序包pylint
,autopep8
并且我配置了VSCode以根据这些程序包格式化代码。
唯一的问题是:在Python项目中,我正在处理的行长是100。所以我所有的代码如下所示:
错误提示:E501:line too long (97 > 79 characters)
。这是我的VSCode设置:
{
"python.pythonPath": "~/.envs/myProject/bin/python",
"python.linting.pep8Enabled": true,
"python.linting.pylintPath": "~/.envs/myProject/bin/pylint",
"python.linting.pylintArgs": ["--load-plugins", "pylint_django", "--max-line-length=100"],
"python.formatting.autopep8Args": ["--max-line-length=100"],
"python.linting.pylintEnabled": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
".vscode": true,
"**/*.pyc": true
}
}
这些设置至少现在可以确保保存时的格式将行数保持在最大100,并且不会将我的所有文件行都换成79。如果没有警告,那还是很棒的。
如何禁用这些短毛猫警告?
1> J. Hesters..:
我想出了怎么做。将此行添加到您的设置:
"python.linting.pep8Args": ["--max-line-length=100"],