我想在 Visual Studio Code 中使用自动保存并应用 flake8、mypy、isort 和 black 等常用工具。
Flake8、mypy 和 black 工作正常,但 isort 根本不工作。有办法解决这个问题吗?
我的 settings.json 文件如下所示:
{
"python.terminal.activateEnvInCurrentTerminal": false,
"python.defaultInterpreterPath": "${workspaceFolder}\\.venv\\Scripts\\python.exe",
"python.linting.enabled": true,
"python.linting.lintOnSave": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.flake8Path": "${workspaceFolder}\\.venv\\Scripts\\pflake8.exe",
"python.linting.mypyEnabled": true,
"python.formatting.provider": "black",
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.formatOnSave": true
}
}
Run Code Online (Sandbox Code Playgroud)