简体   繁体   English

在 python 中,VSCode 调试器不会进入外部代码。 无法弄清楚如何在 launch.json 中编辑“justMyCode”

[英]In python, VSCode debugger won't step into external code. Can't figure out how to edit "justMyCode" in launch.json

I have been referring tohttps://code.visualstudio.com/docs/python/debugging#_justmycode and How to disable "just my code" setting in VSCode debugger?我一直在参考https://code.visualstudio.com/docs/python/debugging#_justmycode如何在 VSCode 调试器中禁用“只是我的代码”设置?

Despite many attempts, still unable to figure out where to put "justMyCode": false in launch.json.尽管进行了多次尝试,但仍然无法弄清楚在 launch.json 中将“justMyCode”:false 放在哪里。 Everywhere I try to put it the editor says "Property justMyCode is not allowed "我试图把它放在任何地方,编辑器都会说“不允许使用属性 justMyCode”

Below is a copy of my launch.json.下面是我的launch.json的副本。 Can someone tell me what should I do?有人可以告诉我该怎么做吗?

{
    // 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 (Integrated Terminal)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false
        },
        {
            "name": "Python: Remote Attach",
            "type": "python",
            "request": "attach",
            "port": 5678,
            "host": "localhost",
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "."
                }
            ]
        },
        {
            "name": "Python: Module",
            "type": "python",
            "request": "launch",
            "module": "enter-your-module-name-here",
            "console": "integratedTerminal"
        },
        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/manage.py",
            "console": "integratedTerminal",
            "args": [
                "runserver",
                "--noreload",
                "--nothreading"
            ],
            "django": true
        },
        {
            "name": "Python: Flask",
            "type": "python",
            "request": "launch",
            "module": "flask",
            "env": {
                "FLASK_APP": "app.py"
            },
            "args": [
                "run",
                "--no-debugger",
                "--no-reload"
            ],
            "jinja": true
        },
        {
            "name": "Python: Current File (External Terminal)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "externalTerminal"
        },
        {
            "name": "Debug Unit Test",
            "type": "python",
            "request": "attach",
            "justMyCode": false
        }
    ]
}

It's not enough to Try setting "justMyCode": false as the message in the VS Code debugger suggests.正如 VS Code 调试器中的消息所暗示的那样, Try setting "justMyCode": false是不够的。 You also need to change "request": "launch" to "request": "test" if you want to step through external code.如果要单步执行外部代码,还需要将"request": "launch"更改为"request": "test" Here's the Github issue where I found this answer .这是我找到这个答案的 Github 问题

you need to put "purpose": ["debug-test"] too.您也需要输入"purpose": ["debug-test"]

like喜欢

"configurations": [
    {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal",
        "justMyCode": false,
        "purpose": ["debug-test"]
    }
],

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使 VScode launch.json 用于 Python 模块 - How to make VScode launch.json for a Python module VScode 将不再运行 Python 脚本,持续过去 2 周,无法弄清楚 - VScode won't run Python scripts anymore, going on the last 2 weeks and can't figure it out VSCode:launch.json runtimeExecutable for Python? - VSCode: launch.json runtimeExecutable for Python? 有人可以在Mac OS X launch.json上的VS Code中查看这些错误吗? - Can someone look at these bugs in VS Code on mac OS X launch.json isn't working 我无法弄清楚为什么它会一直停止。 它甚至不适用于调试器 - I can't figure out why it keeps terminating. it won't even work with debugger vscode python调试,launch.json中带有参数语法错误 - vscode python debug with arguments syntax error in launch.json 无法弄清楚代码有什么问题。 尝试 string.find() 的替代方法 - Can't figure out what is wrong with the code. Trying an alternative for string.find() 无法弄清楚如何在python中显示循环方程的每一步 - Can't figure out how to display every step of a looped equation in python 如何设置 VsCode launch.json 用于 python 调试特定 function 等? - How do I set VsCode launch.json for python debugging of specific function among others? VSCode无效语法(launch.json,第2行) - VSCode invalid syntax (launch.json, line 2)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM