vscode常用技巧

1、flake8 安装配置

安装

pip install flake8
pip install yapf

配置vscode

打开settings.json文件

  "python.linting.flake8Enabled": true,
  "python.formatting.provider": "yapf",
  "python.linting.flake8Args": ["--max-line-length=248"], 
  "python.linting.pylintEnabled": false 

2、常用配置

lauch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [


        {   "python": "/home/jovyan/.conda/envs/torch1.7/bin/python",
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}

setting.json

{
    "jupyter.jupyterServerType": "local",
    "python.linting.flake8Enabled": true,
    "terminal.integrated.fontFamily": "monospace",
    "terminal.integrated.fontSize": 16,
    "python.envFile": "${workspaceFolder}/.vscode/.env",
    "python.linting.flake8Args": [
        "--max-line-length=1024"
    ],
    "python.formatting.provider": "yapf"
}

.env

PYTHONPATH=./:${PYTHONPATH}

3、函数注释插件

Python Docstring Generator

你可能感兴趣的:(python,vscode,编辑器)