问题描述
我正在尝试将我的 python 格式化程序设置为 autopep8。它已正确安装,但它从未作为 VSCode 中的格式化选项。
"python.formatting.autopep8Path": "C:\\Users\\DawsonSchaffer\\AppData\\Roaming\\Python\\python39\\Scripts\\autopep8.exe","python.formatting.autopep8Args": [
"--max-line-length","160","--aggressive","--in-place"
],"[python]": {
"editor.defaultFormatter": "autopep8",},
我已经更改了所有设置。但是我不确定要为 autopep8 放什么。
"[python]": {
"editor.defaultFormatter": "ms-python.python",or
"[python]": {
"editor.defaultFormatter": "autopep8",
autopep8 在控制托盘中也不可用。
谢谢 道森
解决方法
这是配置
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
在 settings.json 中。
您可以这样设置以应用 autopep8 格式:
"python.formatting.provider": "autopep8","editor.formatOnSave": true,"files.autoSave": "afterDelay",