我注意到一件奇怪的事情,当我们在VSCode中设置
"python.formatting.autopep8Args": [
"--line-length 119"
],
但是,如果此设置处于默认模式,即行长度为79,则它工作得很好。是不是autopep8有什么问题,只能在79行的情况下工作,或者我在VSCode中犯了什么错误。我需要的主要特性是,当我的python程序行太长时,它应该能够将其分成多行。我不想继续使用79个字符的方法。我的首选方法是119个字符。目前,我必须手动缩进大行。除了支持119个字符并自动缩进超过119个字符的行的pep8之外,还有其他格式吗?
我附上了我的settings.json文件数据
{
"window.zoomLevel": 1,
"python.dataScience.sendSelectionToInteractiveWindow": true,
"diffEditor.ignoreTrimWhitespace": false,
"editor.fontSize": 16,
"python.formatting.provider": "autopep8",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"python.autoComplete.addBrackets": true,
"python.formatting.autopep8Args": [
"--line-length 119"
],
// "python.linting.flake8Args": [
// "--max-line-length=120"
// ],
"files.autoSaveDelay": 10000,
"editor.defaultFormatter": "ms-python.python",
"files.autoSave": "afterDelay",
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"editor.quickSuggestions": true,
"editor.codeActionsOnSave": null,
}
发布于 2020-08-15 14:28:25
试验性的对我很有效
"python.formatting.autopep8Args": ["--max-line-length", "120", "--experimental"]
发布于 2020-08-18 15:25:56
这应该行得通-
"python.formatting.provider": "autopep8",
"python.formatting.autopep8Args": [
"--max-line-length",
"120",
"--experimental"
]
https://stackoverflow.com/questions/63314452
复制相似问题