Skip to content

Add support for breakpoint dependencies - #166202

Merged
Connor Peet (connor4312) merged 17 commits into
microsoft:mainfrom
gayanper:wait_for_breakpoint
Jan 10, 2024
Merged

Connor Peet (connor4312) merged 17 commits into
microsoft:mainfrom
gayanper:wait_for_breakpoint

Conversation

@gayanper

@gayanper Gayan Perera (gayanper) commented Nov 12, 2022 •

Copy link
Copy Markdown
Contributor

This change introduce a new breakpoint configuration to configure another breakpoint as a dependency

The breakpoint use the same icon as conditional breakpoint.

Until the dependent breakpoint is hit, the configured breakpoint is skipped from the client side. More information #152428

@connor4312

Copy link
Copy Markdown
Member

Thanks for the PR, and sorry it took so long to get to. This is something I personally would find useful and would like to get in :) however, I think we may want something a little different than this PR:

  • in this PR, all breakpoints are sent to the DA and the client just continue()s if a breakpoint is hit when their precondition trigger hasn't been met. This would be pretty slow if the 'triggeree' is inside a hot loop. Instead, it'd be preferable to only set the triggeree once paused on the breakpoint that triggers it.
  • it doesn't seem like there's UI updates to indicate pending/triggered state, so we'd want to do some work to add that

This month is housekeep for us, but this feature is on my radar for the next few iterations. I'll leave the PR open for now -- if you're still interested in doing work on this, we would welcome the contribution. Otherwise, I may or may not end up building on it to implement the feature, depending on where things stand.

Thanks again for your contribution!

@gayanper

Copy link
Copy Markdown
Contributor Author

Thanks for the PR, and sorry it took so long to get to. This is something I personally would find useful and would like to get in :) however, I think we may want something a little different than this PR:

  • in this PR, all breakpoints are sent to the DA and the client just continue()s if a breakpoint is hit when their precondition trigger hasn't been met. This would be pretty slow if the 'triggeree' is inside a hot loop. Instead, it'd be preferable to only set the triggeree once paused on the breakpoint that triggers it.
  • it doesn't seem like there's UI updates to indicate pending/triggered state, so we'd want to do some work to add that

This month is housekeep for us, but this feature is on my radar for the next few iterations. I'll leave the PR open for now -- if you're still interested in doing work on this, we would welcome the contribution. Otherwise, I may or may not end up building on it to implement the feature, depending on where things stand.

Thanks again for your contribution!

Thanks for the feedback Connor Peet (@connor4312) . I will start working on the first point which I do agree with you. For the second suggestion on the UI part, Are you thinking of a new icon ?

@connor4312

Copy link
Copy Markdown
Member

Yea, I think they should show in an "unverified" state until triggered, maybe reuse the issue-draft codicon?

@roblourens roblourens removed their assignment Dec 15, 2023
@gayanper

Copy link
Copy Markdown
Contributor Author

Connor Peet (@connor4312) I did the changes you suggested, please check and let me know what you think. Also I still in doubt of the namings I used for this new feature. Using waitFor is not something I'm happy about, if you do have a better suggestion I would like to change to it.

@gayanper

Gayan Perera (gayanper) commented Dec 17, 2023 •

Copy link
Copy Markdown
Contributor Author

Yea, I think they should show in an "unverified" state until triggered, maybe reuse the issue-draft codicon?

Yes the issue-draft looks good as well. Let's change to it when we finalize the logic behind the behavior. So now I have made dependent breakpoints unverified until they become active.

@connor4312

Connor Peet (connor4312) commented Dec 18, 2023 •

Copy link
Copy Markdown
Member

Some initial notes using the UI 🙂

  • We'd want a context menu option here to set a trigger point. Perhaps disabled unless there's >1 breakpoint

    image
  • If the breakpoint path is in a workspace folder, we can probably show it more nicely here by omitting the folder name.

    image
  • We probably want some icon here to show that the breakpoint is waiting to be set rather than being a normal univerified breakpoint

    image
  • It seems like disabled dependent breakpoints are still hit, we should check if a BP is enabled before setting it

  • We probably want something to happen, perhaps a confirmation box similar to when conditional breakpoints are removed, if a breakpoint with dependent breakpoints is removed.

  • We should probably have a "close" or "ok" button in the breakpoint widget. Right now the only way to close the widget if there aren't other breakpoints is by focusing the editor and pressing escape which is a little annoying.

@connor4312 Connor Peet (connor4312) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, excited to see this happening :)

@connor4312

Copy link
Copy Markdown
Member

I pushed a few changes. I think the last pending things for me are those in the Breakpoints view to reflect state better...

- change feature name to triggeredBy
- add close button
- add actions
- add confirmation on toggle
@gayanper

Copy link
Copy Markdown
Contributor Author

I pushed a few changes. I think the last pending things for me are those in the Breakpoints view to reflect state better...

Ops, I did few changes during last few days and just pushed them, I think I might have overwritten your changes, sorry, I should have checked the MR before force pushing into my branch.

But please feel free to push your changes over mine, I can then have a look at the remaining. Only thing that was pending in my changes was the path and button label and icon to be decided.

@connor4312

Copy link
Copy Markdown
Member

No worries, I still have them locally, will push

@connor4312

Copy link
Copy Markdown
Member

Re-applied, and I fixed up some of the styling on the widget too

@gayanper

Copy link
Copy Markdown
Contributor Author

Re-applied, and I fixed up some of the styling on the widget too

Thanks, and I started to add icons and I will use a mix of default breakpoint icons and issue-draft to see how it comes out. Then we can decide if we want new icons or if we can change the icons in the code to something else.

@gayanper

Copy link
Copy Markdown
Contributor Author

Connor Peet (@connor4312) I tried to see if we can improve the icons than how it look like now. But I cannot see a better way than using

  • conditional breakpoint icon while not debugging
  • show unverified icon until the trigger point is hit
  • show the conidinal breakpoint icon when the breakpoint is sent to DA and verified

If we use these icons, we will be able to expand this feature later into other type of breakpoints easily.

I also tried to treat this pending state as a separate breakpoint state like the unsupported breakpoint state by using issue-draft icon, But I didn't find how to get the issue-draft icon in the same size as other debug icons in stylesheets.

I would like to get some hints over here.

- Referencing the breakpoint location got tricky when breakpoints
  resolve to different locations than they were initially set at, and
  also as breakpoints change when files change. Instead, use the
  breakpoint UUID.

- Newly-enabled breakpoints were sent for a URI when hit, but in DAP
  sending breakpoints for a URI replaces all the breakpoints in it, so
  this was problematic. Instead track on the breakpoint whether it's
  been triggered for a session.
@connor4312

Copy link
Copy Markdown
Member

The icons look good! I pushed a few more changes from my testing with it. There were some more involved changes I made in my last commit after struggling with some edge cases the way we were doing things. But I think this is about good to merge. roblourens can you give this a spin as well?

@roblourens

roblourens commented Jan 8, 2024 •

Copy link
Copy Markdown
Member

If we are going with "Add Wait For Breakpoint" as the name of the feature, should it be "Add Wait-For Breakpoint"? I wouldn't mind "Add Triggerpoint" personally

@roblourens

Copy link
Copy Markdown
Member

I think that hiding the breakpoint widget after I pick a breakpoint in the dropdown is odd, if the OK button is there I should have to click it

@gayanper

Copy link
Copy Markdown
Contributor Author

I think that hiding the breakpoint widget after I pick a breakpoint in the dropdown is odd, if the OK button is there I should have to click it

I can have a look at it now

@gayanper

Copy link
Copy Markdown
Contributor Author

I think that hiding the breakpoint widget after I pick a breakpoint in the dropdown is odd, if the OK button is there I should have to click it

I can have a look at it now

In this case, should add a cancel button as well ? Or should we let cancellation be handled by escape in editor ?

@roblourens

Copy link
Copy Markdown
Member

In this case, should add a cancel button as well ? Or should we let cancellation be handled by escape in editor ?

Cancel by escape is fine, same as for other types of breakpoints.

@vscodenpa VS Code Bot (vscodenpa) added this to the December / January 2024 milestone Jan 10, 2024
@connor4312

Connor Peet (connor4312) commented Jan 10, 2024 •

Copy link
Copy Markdown
Member

I think this is good to go, thank you for all your work on this Gayan Perera (@gayanper)! 👏

The final vocabulary for this is "triggered breakpoint" and "triggering breakpoint" The command name to create a new breakpoint is Debug: Add Triggered Breakpoint.... I kept "Wait for Breakpoint" in the dropdown of the breakpoint widget, since to me that's describing what the input for the breakpoint is, and "wait for breakpoint... foo.js: 12" reads very nicely. It's also a good hint for users who see that new breakpoint type but don't immediately know what a "Triggered Breakpoint" is.

@gayanper

Copy link
Copy Markdown
Contributor Author

Thanks a lot Connor Peet (@connor4312) for the support to get this feature in. 👍

@connor4312
Connor Peet (connor4312) merged commit ea77026 into microsoft:main Jan 10, 2024
@gayanper
Gayan Perera (gayanper) deleted the wait_for_breakpoint branch January 10, 2024 18:38
@roblourens

Copy link
Copy Markdown
Member

Thanks for the contribution, this is cool! Re: the name "triggered breakpoint", it doesn't quite roll off the tongue, I will see if I get used to it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants