I usually code in Python, so I set it in VS Code so that I can code efficiently. I would like to introduce the setting.
It is assumed that you will build a development environment with pipenv
settings.json
json:.vscode/settings.json
{
"[python]": {
"editor.tabSize": 4,
"editor.formatOnSave": true,
"editor.formatOnPaste": false,
"editor.formatOnType": false,
"editor.insertSpaces": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
},
"python.pythonPath": "${workspaceFolder}/.venv/bin/python",
"python.envFile": "${workspaceFolder}/.env",
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.pycodestyleEnabled": false,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "black",
"python.formatting.blackPath": "${workspaceFolder}/.venv/bin/black",
"python.sortImports.path": "${workspaceFolder}/.venv/bin/isort",
"python.linting.mypyEnabled": true,
"python.linting.mypyPath": "${workspaceFolder}/.venv/bin/mypy",
"python.linting.mypyArgs": [
"--config-file", "mypy.ini"
],
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"-vv",
"--show-capture=all",
"tests"
],
"autoDocstring.docstringFormat": "google",
}
"python.envFile": "${workspaceFolder}/.env"
If you specify the file that sets the environment variable in python.envFile, the environment variable will be read.
In order to automatically format the import statement with isort, it is necessary to set to enable automatic formatting in addition to specifying the PATH of iceplant.
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
The settings are written in the pull request of Add isort CodeAction (sort imports on save) # 1926.
docstring
docstring uses google notation.
Type " ""
and press Enter to automatically complete the docstring.
"autoDocstring.docstringFormat": "google"
Recommended Posts