vimspector icon indicating copy to clipboard operation
vimspector copied to clipboard

[Feature Request]: Toggle Break on Exception while running

Open SamCB opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Break on Exception debugging can be very useful to figure out what's happening in a certain part of the project, but it's a hassle to have on all of the time. Say you have a project that uses exceptions as a significant part of the logic flow (as is some people advocate in some languages such as python), or use exceptions a lot in handling things tangential to your logic (such as connectivity and requests). Without being able to toggle breaking on exceptions, you could be spending a long time walking through exception after exception, to get to the point you're actually trying to inspect.

Best use case, would be to have break on exception turned off... set a breakpoint at the beginning of the code you want to debug, and when you reach it, turn it on and continue.

Describe the solution you'd like

Three potential ways I can see to do this.

  • Two new functions that let you toggle break on exception and break on uncaught exception, e.g. vimspector#ToggleBreakOnException() and vimspector#ToggleBreakOnUncaughtException().
  • Two new functions that let you set break on exception, e.g. vimspector#BreakOnException(1) and vimspector#BreakOnUncaghtException(0).
  • Two global variables or settings that could be set, e.g. let g:vimspector_break_on_exception = 1

Having these available will also remove the need for the questions on launch.

Describe alternatives you've considered

Helpfully vimspector#ClearBreakpoints() now clears the break on exception questionaire, which means you no longer need to restart vim to change the settings. However it still doesn't let us easily turn the feature on mid session.

Additional context

VScode handles this by having a couple of checkboxes on top of the list of all breakpoints. You can toggle these any time you want.

SamCB avatar Mar 09 '20 23:03 SamCB

Would also be nice if this could be included alongside #10.

SamCB avatar Mar 09 '20 23:03 SamCB

It isn't possible to have a completely simple API for this due to the way DAP works. It's completely adapter-specific what "questions" are asked. It's probably a bunch of UI work whatever, so yeah #10 is the likely candidate for that, though that's not going to happen any time soon.

puremourning avatar Mar 24 '20 08:03 puremourning

this would be super cool, it's also a feature in vscode 🤙

Tomburgs avatar Aug 15 '23 07:08 Tomburgs

This was implemented a while ago. The Breakpoints window has a "Clr Exp" (Clear Exception Breakpoints config) button, and there is vimspector#ResetExceptionBreakpoints() you can call, though that's not currently documented.

puremourning avatar Oct 01 '23 22:10 puremourning