本文介绍了在 python 中,VSCode 调试器不会进入外部代码.不知道如何编辑“justMyCode";在launch.json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在指https://code.visualstudio.com/docs/python/调试#_justmycode如何禁用仅我的代码"VSCode 调试器中的设置?

尽管尝试了很多次,仍然无法弄清楚该放在哪里justMyCode":launch.json 中的 false.我试图把它放在任何地方,编辑器都会说不允许使用 justMyCode 属性"

下面是我的launch.json 的副本.谁能告诉我该怎么办?

{//使用 IntelliSense 了解可能的属性.//悬停以查看现有属性的描述.//更多信息,请访问:https://go.microsoft.com/fwlink/?linkid=830387版本":0.2.0",配置":[{"name": "Python:当前文件(集成终端)",类型":蟒蛇",请求":启动","program": "${file}","console": "integratedTerminal",justMyCode":假},{"name": "Python:远程连接",类型":蟒蛇","请求": "附加",端口":5678,主机":本地主机",路径映射":[{"localRoot": "${workspaceFolder}",远程根":."}]},{"name": "Python: 模块",类型":蟒蛇",请求":启动","module": "在此处输入您的模块名称",控制台":集成终端"},{"name": "Python: Django",类型":蟒蛇",请求":启动","program": "${workspaceFolder}/manage.py","console": "integratedTerminal",参数":["运行服务器","- 没有重装",--无线程"],django":真的},{"name": "Python: Flask",类型":蟒蛇",请求":启动",模块":烧瓶",环境":{"FLASK_APP": "app.py"},参数":[跑","--无调试器","- 没有重装"],jinja":真的},{"name": "Python:当前文件(外部终端)",类型":蟒蛇",请求":启动","program": "${file}",控制台":外部终端"},{"name": "调试单元测试",类型":蟒蛇","请求": "附加",justMyCode":假}]}
解决方案

按照 VS Code 调试器中的消息所建议的那样,Try setting "justMyCode": false 是不够的.如果要单步执行外部代码,还需要将 "request": "launch" 更改为 "request": "test".这是我找到这个答案的 Github 问题.>

I have been referring to https://code.visualstudio.com/docs/python/debugging#_justmycodeandHow to disable "just my code" setting in VSCode debugger?

Despite many attempts, still unable to figure out where to put"justMyCode": false in launch.json. Everywhere I try to put it the editor says "Property justMyCode is not allowed "

Below is a copy of my 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. You also need to change "request": "launch" to "request": "test" if you want to step through external code. Here's the Github issue where I found this answer.

这篇关于在 python 中,VSCode 调试器不会进入外部代码.不知道如何编辑“justMyCode";在launch.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 19:53