PowerShellEditorServices
PowerShellEditorServices copied to clipboard
Add Breakpoint Label frame to optimize debug stepping performance
PR Summary
Implements DAP DelayedStackTraceLoading and returns an artificial breakpoint label frame based on the invocation info ASAP once the debugger stops. The rest of the stack trace is then returned on a future request that doesn't block the client UI.
https://github.com/user-attachments/assets/b909655b-1085-4f8e-a453-99b8af21b877
PR Context
Debug stepping takes 300ms+ due to waiting for stack trace collection via the slow Get-PSCallStack "hack". Further improvements will come around this later.
@SeeminglyScience @andyleejordan I made this a fairly minimal PR to be easy to review. Additional things I plan to do next as future incrementals
- Add start/end/column positioning to all stack frames (it's available in the position property, just has to be serialized properly)
- Separate variable and frame processing into independent resolution paths
- Implement "fast path" for local runspace sessions to use the runspace debugger properties and methods rather than going thru the pipeline to fetch the frame info, ~2-3ms vs 300ms-800ms
- Move all the scope/stack/variable resolution to a new async-based
DebugStoppedContextclass that can be disposed and re-instantiated cleanly and kept separate from theDebugServiceconcerns, since LSP spec says no IDs/etc. should be reused between debug adapter stop/resumes
@SeeminglyScience @andyleejordan I made this a fairly minimal PR to be easy to review. Additional things I plan to do next as future incrementals
- Add start/end/column positioning to all stack frames (it's available in the position property, just has to be serialized properly)
- Separate variable and frame processing into independent resolution paths
- Implement "fast path" for local runspace sessions to use the runspace debugger properties and methods rather than going thru the pipeline to fetch the frame info, ~2-3ms vs 300ms-800ms
- Move all the scope/stack/variable resolution to a new async-based
DebugStoppedContextclass that can be disposed and re-instantiated cleanly and kept separate from theDebugServiceconcerns, since LSP spec says no IDs/etc. should be reused between debug adapter stop/resumes
I'm super excited for all of this.
This has been rebased to the latest prerelease and is good for re-review.
@andyleejordan @SeeminglyScience your opinions have officially been deemed irrelevant by our AI overlords, please approve as is /s
All feedback should be addressed. I also removed some of the TraceOutput log stuff I was experimenting with, I'm going to submit a separate test-specific PR to revamp the DAP E2E tests.
@andyleejordan this wording sounded so unnecessarily passive aggressive, LOL
Thanks! Excited to speed this up, it's annoyed me for YEARS.