Daw*_*fer 9 python autopep8 visual-studio-code
我正在尝试将 python 格式化程序设置为 autopep8。它已正确安装,但它从未作为 VSCode 中的格式化选项。
"python.formatting.autopep8Path": "C:\\Users\\DawsonSchaffer\\AppData\\Roaming\\Python\\Python39\\Scripts\\autopep8.exe",
"python.formatting.autopep8Args": [
"--max-line-length",
"160",
"--aggressive",
"--aggressive",
"--in-place"
],
"[python]": {
"editor.defaultFormatter": "autopep8",
},
Run Code Online (Sandbox Code Playgroud)
我已经更改了所有设置。但是我不确定要为 autopep8 添加什么。
"[python]": {
"editor.defaultFormatter": "ms-python.python",
},
or
"[python]": {
"editor.defaultFormatter": "autopep8",
},
Run Code Online (Sandbox Code Playgroud)
此外,autopep8 在控制托盘中不可用。
谢谢道森
这是要配置的
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
Run Code Online (Sandbox Code Playgroud)
在settings.json中。
您可以这样设置以应用 autopep8 格式:
"python.formatting.provider": "autopep8",
"editor.formatOnSave": true,
"files.autoSave": "afterDelay",
Run Code Online (Sandbox Code Playgroud)