【发布时间】:2021-09-13 04:25:39
【问题描述】:
我目前是开发容器中的开发人员,我正在尝试使用黑色作为 python 的格式化程序。但是,我未能使其工作。这是我的.devcontainer.json
{
"name": "api",
"dockerComposeFile": ["../docker-compose.yml", "../docker-compose.devcontainer.yml"],
"service": "api",
"workspaceFolder": "/workspace/api",
"settings": {
"python.defaultInterpreterPath": "/usr/local/lib/python3.8",
"python.formatting.provider":"black",
"python.formatting.blackPath":"/usr/local/lib/python3.8/site-packages/black",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.mypyEnabled":true,
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.detectIndentation":false,
"editor.formatOnSave":true,
},
"shutdownAction": "none",
"extensions": ["ms-python.python", "ms-python.vscode-pylance","ms-azuretools.vscode-docker"],
//this is port forwarding for the debugger
"forwardPorts": [8000]
}
【问题讨论】:
-
这里有一个可能的解决方案:github.com/microsoft/vscode-python/issues/7165
-
@Ezra ,它已经使用 pip 安装了
标签: python python-black vscode-devcontainer