Rev*_*t64 12 visual-studio-code vscode-debugger
在调试器(C#.NET Core)中启动我的项目时,它表示正在调试“仅我的代码”。
我也想调试库,并且在VSCode的任何地方都看不到禁用此设置的设置。
可以禁用吗?
war*_*ens 40
VSCode 1.60 抱怨"request": "test"其他人建议的方法。
但我确实必须在现有配置下面添加一个新部分"justMyCode": false才能开始工作。
这对我有用:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": [
"blah",
"whatever"
]
},
{
"name": "Python: Debug Unit Tests",
"type": "python",
"request": "launch",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false,
}
]
}
Run Code Online (Sandbox Code Playgroud)
添加目的似乎很重要。
我发现这里记录了正确的方法:https ://code.visualstudio.com/docs/python/testing#_debug-tests
小智 12
我向 launch.json 添加了“justMyCode”: false”设置,但它仍然没有在外部库代码中的断点处停止。更令人困惑的是:它确实工作过一次,然后突然不再工作了。
然后我发现:如果您在“运行和调试(SHIFT+CMD+D)”选项卡中并选择您的配置,然后单击绿色三角形/“开始调试(F5)”,它就可以工作!但是,如果我单击右上角的“调试 Python 文件”,它不会停止在外部库代码中!
如果您专门调试 Python 单元测试,则添加"justMyCode": "false"到正常配置是行不通的,您需要在 launch.json 中添加另一个"request": "test":
{
"name": "Debug Unit Test",
"type": "python",
"request": "test",
"justMyCode": false,
},
Run Code Online (Sandbox Code Playgroud)
来源:Github Microsoft/vscode-python 问题 #7131
小智 5
只是添加"justMyCode": false到launch.json不起作用。您需要在launch.json下面添加一个单独的配置。仅供参考,每个{}代表一个配置。
"configurations": [
{
.... # existing config
},
{
"name": "Debug Unit Test",
"type": "python",
"request": "test",
"justMyCode": false,
}
]
Run Code Online (Sandbox Code Playgroud)
正如这里所指出的
| 归档时间: |
|
| 查看次数: |
3834 次 |
| 最近记录: |