Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 to https://code.visualstudio.com/docs/python/debugging#_justmycode and How 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
        }
    ]
}

like image 658
Cloud Avatar asked Oct 16 '22 09:10

Cloud


1 Answers

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.

like image 90
Matt Avatar answered Oct 18 '22 23:10

Matt