/vscode_how2

Various settings and hints for Visual Studio Code

MIT LicenseMIT

Visual Studio Code - settings and hints

General

Extensions

Git

Markdown

Example: .markdownlint.json:

{       "default": true,
        "MD007": { "indent": 4 },
        "MD013": false,
        "MD024":{"siblings_only":true},
        "no-hard-tabs": false
}

Example: workspace setting

    "markdownlint.config": {
        "default": true,
        "MD007": { "indent": 4 },
        "MD013": false,
        "MD024":{"siblings_only":true},
        "no-hard-tabs": false
    }

Other

Python Development

Installed modules (via conda)

All modules in one script:

conda install -c conda-forge yapf
conda install -c conda-forge flake8
conda install -c conda-forge pytest

Optionally conda install -c conda-forge jedi

Extensions

Settings

Selecting Conda Environment

  • Press Ctrl+Shift+P and start typing Python int to get to Python: Select Interpreter
  • Choose the conda environment you want to use in your project
  • You can see changes directly in your Workspace settings
    "python.pythonPath": "C:\\dev\\Anaconda3\\envs\\py36\\python.exe"
  • If it doesn't work correctly (eg. your terminal is not switching to specific environment), you can play with settings for your terminal and add
    "terminal.integrated.shellArgs.windows": [
        "/K",
        "C:/dev/Anaconda3/Scripts/activate.bat",
        "C:/dev/Anaconda3/envs/py36"
    ]

Formating

  • You can configure the format provider by changing a setting in the User or Workspace settings file as follows:
"python.formatting.provider": "yapf"
  • You can fine tune yapf settings by adding .style.yapf to the root directory of your project. My typical change is
# The column limit.
column_limit=120

Linting

  • You can configure default linter either by pressing Ctrl+Shift+P and start typing lint to get to Python: Select Linter or by changing it in Workspace settings
    "python.linting.pylintEnabled": false,
    "python.linting.flake8Enabled": true,
    "python.linting.enabled": true,

Links to other list of useful extensions