我正在尝试调试在VSCode中运行在docker中的代码。在意识到问题不在我的代码中,而是在我正在使用的库中之后,我尝试在launch.json文件中设置launch.json。
问题是,当一个人在坞内调试时,lauch.json不接受justMyCode : false,即使我把它放在那里,它也不起作用。
我的配置文件:
lauch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Docker: Python - General",
"type": "docker",
"request": "launch",
"preLaunchTask": "docker-run: debug",
"justMyCode": false, #This does not work
"python": {
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}
],
"projectType": "general"
}
}
]
}tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "docker-build",
"label": "docker-build",
"platform": "python",
"dockerBuild": {
"tag": "indeednewversionnoapi:latest",
"dockerfile": "${workspaceFolder}/Dockerfile",
"context": "${workspaceFolder}",
"pull": true
}
},
{
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": [
"docker-build"
],
"python": {
"file": "main.py",
"args": ["--location","new_york", "--country","us","--from_age","14"]
}
}
]
}发布于 2022-08-19 09:40:37
问题在于justMyCode字段的放置。
在没有停靠器的情况下运行时,可以在配置中直接使用justMyCode:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Arquivo Atual",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false,
"args": [ "--location","New York", "--country","us","--from_age","14"]
}
]
}但是,在使用docker时,它必须进入python的内部,并透露:
{
"version": "0.2.0",
"configurations": [
{
"name": "Docker: Python - General",
"type": "docker",
"request": "launch",
"preLaunchTask": "docker-run: debug",
"python": {
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}
],
"projectType": "general",
"justMyCode": false,
}
}
]
}https://stackoverflow.com/questions/73386694
复制相似问题