8

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

Cloud
  • 81
  • 1
  • 2

2 Answers2

7

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.

Matt
  • 169
  • 2
  • 3
  • 1
    This doesn't work for me, it just says `value is not accepted` after changing it to test – cluis92 Aug 26 '20 at 15:23
  • 2
    This doesn't work for me either, it says I must use "Python: Debug Unit Tests". But I'm not trying to debug a test. I'm trying a regular python file. Not sure what OP is trying to debug. Edit: I was able to get it to work by using "request:: "launch" and putting "justMyCode": false in my launch.json instead of the global vscode settings. – jewbix.cube Sep 03 '20 at 06:53
  • @cluis92 It shows that for me too, but I saved it anyway and ran the unit test with debugging and it worked fine. – davzaman Jan 19 '22 at 23:57
  • 1
    This did the trick for me even though Vscode complained that `"test"` was not allowed (only "launch" or "attach" is allowed) – Zephaniah Grunschlag May 03 '22 at 14:49
  • This is really confusing. It does not work for me. It marks the "value is not accepted" but following the suggestion above I ran it regardless but still does not work. – Heberto Mayorquin Sep 19 '22 at 11:12
4

you need to put "purpose": ["debug-test"] too.

like

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