使用Python扩展,使用yapf - 当我点击格式时没有任何反应:
我的工作区设置:
// Place your settings in this file to overwrite the default settings
{
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/js-build": true
},
"editor.scrollBeyondLastLine": false,
"python.pythonPath": "/Users/joshma/.envs/venv/bin/python",
"python.linting.flake8Path": "/Users/joshma/.envs/venv/bin/flake8",
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"editor.formatOnType": true,
"python.formatting.provider": "yapf",
"python.formatting.yapfPath": "/Users/joshma/.envs/venv/bin/yapf"
}
我采取的步骤:
foo('a' )
cat path/to/file.py | yapf
格式为foo('a')
我可能没有正确设置某些路径/配置 - 是否有某种方法可以调试它?
答案 0 :(得分:0)
我认为你错过了这个选项,
python.formatting.formatOnSave
这是我的配置,格式化正常,
"python.formatting.formatOnSave": true,
"python.formatting.provider": "yapf",
"python.formatting.yapfPath": "/usr/bin/yapf"
答案 1 :(得分:0)