基本有4個 extension 要裝:
- Python
- Code Runner
- MagicPython
- Python for VSCode
目前我的 Django 專案用的設定是這樣:
{
"python.pythonPath": "/home/user/.virtualenvs/myproject/bin/python",
"python.linting.flake8Enabled": true,
"python.formatting.provider": "autopep8",
"name": "Django",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"program": "${workspaceRoot}/manage.py",
"args": [
"runserver",
"--noreload"
],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput",
"DjangoDebugging"
]
}
因為我用的是 virtualenv ,所以 python 執行檔跟相關的 library 都是在 $HOME/.virtualenv 這裡,把 python.pythonPath 設到這裡以後, intellisense/autocomplete 就可以正常運作。此外我也加上了 linting 與執行、除錯的相關設定。
其他還有 Jupyter 等等的,還沒去深入了解,再找時間來看。
沒有留言:
張貼留言