Skip to content

Support condition and hit count on data breakpoints (fix #188721)#195710

Merged
connor4312 merged 5 commits intomicrosoft:mainfrom
gjsjohnmurray:fix-188721
Nov 28, 2023
Merged

Support condition and hit count on data breakpoints (fix #188721)#195710
connor4312 merged 5 commits intomicrosoft:mainfrom
gjsjohnmurray:fix-188721

Conversation

@gjsjohnmurray
Copy link
Contributor

This PR fixes #188721 by making a data breakpoint's "Edit Condition..." context menu entry produce the same inline editor as already happens for function breakpoints. Also did the same for Hit Count (not previously in the context menu for data breakpoints).

Repro steps are available on #195695

@roblourens roblourens added this to the November 2023 milestone Oct 23, 2023
@roblourens
Copy link
Member

Thanks @gjsjohnmurray! A couple questions

Other exception rows have the pencil button to edit the condition, should we add the toolbar for the data breakpoints too?
image

And normal breakpoints have the X button, I'm not sure why that wasn't adopted here.

And exception breakpoints show the condition inline, but there isn't any way to see that the data breakpoint has a condition, do you think we should try to add the condition to the description?
image

@gjsjohnmurray
Copy link
Contributor Author

@roblourens thanks for the feedback. I have pushed the improvements:

image

@gjsjohnmurray
Copy link
Contributor Author

@roblourens I think this is ready for merging to catch its November milestone's endgame.

@roblourens
Copy link
Member

Seeing some unit test failures that look relevant

@gjsjohnmurray
Copy link
Contributor Author

Fixed, and tests now passed.

@roblourens roblourens enabled auto-merge (squash) November 28, 2023 03:28

const primary: IAction[] = [];
this.breakpointSupportsCondition.set(!session || !!session.capabilities.supportsConditionalBreakpoints);
this.breakpointItemType.set('dataBreakpoint');
Copy link
Member

@connor4312 connor4312 Nov 28, 2023

Choose a reason for hiding this comment

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

The usual way to do this would be with an overlaid context key service, which avoids having to re-evaluate context keys globally in vs code. Example:

const getActionableElementActions = (
contextKeyService: IContextKeyService,

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but I think it's been wrong for a long time for other breakpoint types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback. This code currently replicates existing code for function breakpoints.

group: 'navigation',
order: 20,
when: CONTEXT_BREAKPOINT_ITEM_TYPE.isEqualTo('functionBreakpoint')
when: ContextKeyExpr.or(CONTEXT_BREAKPOINT_ITEM_TYPE.isEqualTo('functionBreakpoint'), CONTEXT_BREAKPOINT_ITEM_TYPE.isEqualTo('dataBreakpoint'))
Copy link
Member

Choose a reason for hiding this comment

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

I noticed when looking at the precondition that this is enabled when supportsConditionalBreakpoints, not when supportsHitConditionalBreakpoints. Not an issue in this PR, but something we should fix 🤔

@connor4312 connor4312 disabled auto-merge November 28, 2023 03:49
Copy link
Member

@connor4312 connor4312 left a comment

Choose a reason for hiding this comment

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

lgtm overall

@connor4312 connor4312 merged commit 3de501a into microsoft:main Nov 28, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants