Change "Step Back" to use "RestartFrame" #2171
Copy link
Copy link
Closed
Labels
in debuggingRelates to the debug adapter or process of running debug sessionsRelates to the debug adapter or process of running debug sessionsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.
Milestone
Description
Turns out the DAP has a message for RestartFrame, and using StepBack for this wasn't necessary:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in debuggingRelates to the debug adapter or process of running debug sessionsRelates to the debug adapter or process of running debug sessionsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.
Activity
nbros commentedon Dec 15, 2019
VS Code v1.41 also has a new inline action in the call stack view that seems like a good place to put this action:

https://code.visualstudio.com/updates/v1_41#_restart-frame-as-an-inline-action-in-the-call-stack-view
DanTup commentedon Dec 17, 2019
It was that release note that made me realise I'd used the wrong thing 😄 I believe by moving it to use the correct request, it will automatically appear here :-)
nbros commentedon Dec 20, 2019
Good 🙂
Would that allow restarting from any selected frame even the current one? Currently the "Step Back" command seems to restart from the parent frame instead of the current frame, with confusing results when the top method in the stack is async (the whole stack changes instead of just the top frame when stepping back through an async gap).
DanTup commentedon Dec 20, 2019
Yep!
Hmm, I'm not sure this would change. Currently we send Rewind with no frame offset which means it defaults to 1, which is the lowest value allowed (see docs). In my testing, it moved you up a frame, but such that "step into" would go back into the function you were previously in?
I'm not sure I understand what you mean, butI suspect this feature is acting upon the real stack rather than the "async stack" we show (which is simplified to make async code easier to understand).
nbros commentedon Dec 20, 2019
Thank you for your explanation, I hadn't realized that the Step Back action was rewinding to the call site in the parent frame instead of the beginning of the current frame.
That is a good explanation, thanks!
DanTup commentedon Dec 23, 2019
I've changed this over and it now works from the calls stack. However, the thing mentioned above is weird (you can only restart parent frames) and trying to do it on the current frame fails because Rewind doesn't support restarting from the current stack frame. VS Code also fails to render the error (I've opened microsoft/vscode#87605) so this failure is currently silent.