nro*_*fis 14 python formatting flake8 visual-studio-code linter
我正在使用flake8Python 的 linter,并且有很多代码格式问题,例如blank line contains whitespace flake8(W293)
我正在尝试自动修复这些 linting 问题。我有这些设置:
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.lintOnSave": true,
"python.linting.flake8Args": [
"--ignore=E501",
],
"editor.formatOnSave": true
Run Code Online (Sandbox Code Playgroud)
我正在使用默认autopep8格式化程序,但它似乎什么也没做。当我保存文件或运行命令时没有任何反应Format Document。
有什么方法可以自动修复这些 linting 错误吗?
例如,我建议使用formatter黑色来修复.linter
如果是这样,pip install请将其添加到您的settings.json中:
"python.formatting.provider": "black"
Run Code Online (Sandbox Code Playgroud)
然后,按Alt+ShifT+F或Ctrl+S应该会触发脚本的格式设置。
| 归档时间: |
|
| 查看次数: |
30883 次 |
| 最近记录: |