-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement justMyCode
fine grained control feature in debugger
#159
Comments
justmycode
in new debuggerjustMyCode
in new debugger
Providing a way to provides overrides might also be useful (but probably not worth worrying about until someone asks for it). And doing this as a string for future flexibility makes sense for if/when we provide the flexibility of just stdlib or just 3rd-party. |
I'm holding off for now, as just my code is a little flaky in PTVSD. |
I'd suggest that we consider "My Code" to be anything that is NOT inside of site_packages or in the stdlib. I may open just one subdirectory in my code base but still reasonably expect to be able to step files in other parts of my code base. However, I wouldn't expect to step into site packages that I've installed, or the standard lib (since I can't easily modify those). |
When you install something with |
@brettcannon good point, I think it's fair to treat those as if they are external packages in that case |
@brettcannon We might want to add this to the new milestone. |
@DonJayamanne I believe this needs upstream work from ptvsd |
Blocked by microsoft/ptvsd#802 |
justMyCode
in new debuggerjustMyCode
feature in debugger
Capturing discussion with Don, for now this setting will be Later if we want to add customizations we can add additional settings. The below are not in scope for this issue, but documenting them for future reference:
Filters would start by first excluding and then including. This allows users to debug into e.g. django.models by adding a single setting: The reason to add these as separate settings is it allows you to turn the whole thing on/off without changing your workspace's definition of My Code. |
Will there be a option to skip stdlib but step into everything else? I rarely ever want to step into the standard python library but I step into pip modules sometimes. |
@Almenon we haven't decided yet. |
I do have exactly this use case: I'm debugging a failing python test that uses an installed package. The failure occurs in the installed package but is caused by my package. In order to understand what I did wrong I need to step into the installed package. |
@Flamefire to step into site packages you can disable the "justMyCode" feature. Does that work for you, or do you need to have separate control of skipping stdlib vs. site packages? Right now we only have a single on or off switch for the feature, so we've decided for now that "my code" is anything that is NOT in site packages or the Python standard library. Stepping into excessive library code/helper functions can really make debugging cumbersome when you are just trying to step through your own code so we're trying to avoid that. |
How to disable that? I found |
Yes, the debugStdLib does what you describe in the current release. Also in the current release "My Code" is defined as everything that's in the opened workspace in VS Code and excludes everything else (opt-in approach). We're changing that in the next release to:
Being able to change it in the middle of a debug session is a good suggestion, we'll keep that in mind as we make future updates to this feature. |
Is there actually an option to enable "justMyCode" for debug sessions started via the codelense? |
@Flamefire no, for that you want microsoft/vscode-python#332 |
@DonJayamanne I came here via #2888 after spending some time perplexed assuming the vs.code python debugger was broken or I hadn't told it properly where the standard python libraries were. |
@dlitster yes, that's a separate issue. |
I don't know if this is the most appropriate place for this to be filed, but it's pretty confusing to me that:
Would it be possible for this to be a bit smarter, and infer that if the user has set breakpoints within a 3rd-party module, then the user likely wants that breakpoint to work? |
@kevinushey please open a separate feature request as this issue is specifically about providing varying levels of "openness" to justMyCode, not justMyCode in general. |
Thank you so much, this works. And to be more specific, the |
justMyCode
feature in debuggerjustMyCode
fine grained control feature in debugger
I'm not sure why you would want to limit where breakpoints can be placed. Does this help improve performance when debugging? Anyway, for anyone who wants to place breakpoints in third-party code while running tests, the following
This is documented here: https://code.visualstudio.com/docs/python/testing#_debug-tests I first tried setting the |
Please don't use |
Thanks! I updated my comment to prevent confusion. |
Not sure if this is the same issue but my case Is this expected? Is there anything else I should config? |
@johnnybigoode It's a different issue - can you please file it separately, and describe it in more detail? Ideally, include the logs from |
Closing this issue. I believe that what's asked here is already achievable through i.e.:
Also, the debugger should notify whether breakpoints are actually active (meaning that if the breakpoint is excluded by some Feel free to reopen if you believe I'm missing something here. |
@fabioz , how can we implement I can't seem to find this setting even in insider builds: Can you reference the PR / extension-repo that allows this? This is a long sought after feature. What I am using as of this moment: VS Code:
Python Extension:
|
It's still not in the vscode-python schema, but it can already be used. |
Full example of launch.json to display the full stack but starting in user code, ie without the useless stack of the {
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false,
"rules": [
{"path": "**/runpy.py", "include": false},
],
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
}
]
} |
This setting could expand into:
just my code
, excludingvirtual envs
)site packages
(Just my code is off
)stdlibs
(Just my code is off
)I.e. we have three states:
Possibly even allowing users to define other directories that fall into
Pkg
category. E.g. user is importing modules from some other directory.I'll try to come up with an extensible structure for this and then we can discuss.
Todo:
The text was updated successfully, but these errors were encountered: