-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Allow debug adapter to control which frame to focus when stopping (eg. on exception) #65012
Comments
(Experimental duplicate detection) |
In general this is a valid request. However, I wonder how realistic it is for a debug adapter to determine the "best frame to focus on" without any help/hints coming from the user. Based on this observation here is an alternative proposal based on an existing concept: VS Code has already the concept of "uninteresting" source. This is surfaced in node-debug via the "skipFiles" glob attribute (which is not part of DAP). Whatever source matches that glob gets the special presentationHint VS Code uses this hint to render stackframes in a dimmed style and collapses adjacent frames into one. We could easily extend VS Code notion of "deemphasized" sources by ignoring them when determining the best frame to focus on. So in your case you could just return the @DanTup what do you think? |
In this case I'm trying to focus on "user code" rather than "framework code", so I think the DA is best placed to know this.
We actually already set this to get the collapsed stack traces, so using this would be perfect for me. We even let the user control this by opting in to debugging framework code if they want, so this would also be more flexible. |
@DanTup I have pushed a fix for this, please try it out in the insiders after we start updating it again after holidays (in 10 days). |
@isidorn Tested in insiders, and it now skips the |
Thanks for trying it out. Adding verified label |
This is slightly related to #64193. The current expected behaviour is that VS Code walks up the stack frames and focuses the first frame that has source code (though it's not working correctly due to that bug).
However, assuming "the first frame with source" is the one that is most relevant isn't the best option. For example some languages/frameworks may ship source code for their internal libraries which means often the implementation of an
assert
method may have source - and this will result in the user looking at that implementation when it may be more appropriate to be looking at their call to it.It would be best if the debug adapter could explicitly control which frame to focus when an exception is hit (most simply would probably be a flag on the frame for whether it should be excluded from auto-focus, and that flag used in place of the current "has source" check, but it could also make sense in the
StoppedEvent
).The text was updated successfully, but these errors were encountered: