vscode 配置格式化代码


VSCode  docs

1. ctrl+shift+p ,输入setting ,选择 preferences:open settings(json)

vscode配置 yapf ,格式化代码, 添加自动补全

{
     // 设置Python的路径,
     "python.pythonPath": "D:\\program\\install\\pycharm\\Anconda2\\envs\\python3\\python.exe",
     // 设置Python的代码格式化
    "python.formatting.provider": "yapf",   
    // 设置Python的代码检查
    "python.linting.flake8Path": "pycodestyle",
    "python.linting.flake8Enabled": true,
  // 自动补全
    "python.autoComplete.extraPaths": [
            "D:/program/install/pycharm/Anconda2/envs/python3/",
            "D:/program/install/pycharm/Anconda2/envs/python3/Lib",
            "D:/program/install/pycharm/Anconda2/envs/python3/Lib/site-packages/",
            "D:/program/install/pycharm/Anconda2/envs/python3/DLLs/"
        ],
     "python.autoComplete.addBrackets": true,
    "workbench.editorAssociations": {
        "*.ipynb": "jupyter.notebook.ipynb"
    },
    "files.insertFinalNewline": true,
    "files.autoSave": "afterDelay",
    "editor.formatOnSave": true,
    "python.formatting.yapfArgs": [
        "--style={based_on_style: pep8, indent_width: 4}"
    ],
    "editor.detectIndentation": false,
    "editor.fontSize": 18,
    "[python]": {


        "editor.wordBasedSuggestions": false
    },
    "python.analysis.extraPaths": [
        "D:/program/install/pycharm/Anconda2/envs/python3/",
        "D:/program/install/pycharm/Anconda2/envs/python3/Lib",
        "D:/program/install/pycharm/Anconda2/envs/python3/Lib/site-packages/",
        "D:/program/install/pycharm/Anconda2/envs/python3/DLLs/"
    ],
    "python.analysis.completeFunctionParens": true,
}
 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM