python - 在 python 中,VSCode 调试器不会进入外部代码。不知道如何在 launch.json 中编辑 "justMyCode"

标签 python visual-studio-code

我一直在指https://code.visualstudio.com/docs/python/debugging#_justmycode

How to disable "just my code" setting in VSCode debugger?

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

下面是我的launch.json 的副本。有人能告诉我该怎么办吗?

{
    // 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
        }
    ]
}

最佳答案

还不够Try setting "justMyCode": false正如 VS Code 调试器中的消息所暗示的那样。您还需要更改"request": "launch""request": "test"如果你想单步执行外部代码。这是the Github issue where I found this answer .

关于python - 在 python 中,VSCode 调试器不会进入外部代码。不知道如何在 launch.json 中编辑 "justMyCode",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58687113/

相关文章:

python - 索引可变维数的 ndarray

visual-studio-code - 如何在 VS Code 中更改 block 关系线颜色

nuget - 如何使用 dotnet CLI 一次更新所有 NuGet 包?

visual-studio-code - VS Live Share和Live Server

visual-studio-code - 关闭 > 换行

python - addinfourl 实例没有属性 'getcode' - Python 2.7.5

python - 在 jupyter notebook 的单元格中使用 sudo

python - 是否有将字符串解析为对其内容的特定解释的函数?

python - Spark(Python)中的 Kolmogorov Smirnov 测试不起作用?

visual-studio-code - 有没有办法告诉 VS Code 我的语言扩展名中的第一行匹配应该覆盖任何文件扩展名?