Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

The "Wait for Breakpoint" dropdown in the conditional breakpoint widget builds its list once on creation and never updates. Adding/removing breakpoints while the widget is open requires closing and reopening to see changes.

Changes

  • Listen to breakpoint model changes: Extended existing onDidChangeBreakpoints listener to call updateTriggerBreakpointList() when in trigger point context
  • Refactored option building: Extracted breakpoint option construction into buildBreakpointOptions() for reuse
  • Dynamic list updates: New updateTriggerBreakpointList() method refreshes SelectBox options while preserving current selection (or clearing it if the selected breakpoint was removed)
  • Context switching: Update list when user switches to "Wait for Breakpoint" mode to ensure freshness

Implementation

The SelectBox already supports dynamic updates via setOptions(options, selectedIndex). Track available breakpoints in availableBreakpoints array and rebuild options on:

  1. Breakpoint model changes (when widget is in trigger point context)
  2. Context switches to trigger point mode

Selection preservation uses breakpoint ID comparison to maintain UX continuity across updates.

Original prompt

This section details on the original issue you should resolve

<issue_title>Conditional 'wait for breakpoint' list should update dynamically</issue_title>
<issue_description>Originally filed microsoft/vscode-dotnettools#2686 (comment)
@vsccarl

Describe the Issue

When adding a conditional breakpoint, then adding a breakpoint to reference in the file elsewhere, the list is not updated unless the breakpoint condition menu is closed and reopened.

Image

Steps To Reproduce

  1. Add a conditional breakpoint to open the condition menu
  2. Add a breakpoint elsewhere in the file to reference
  3. Expand the breakpoint list

Expected Behavior

The list is updated when a new breakpoint is added.

Environment Information

Windows x64
Code Insiders: 1.109.0
C#: prerelease 2.111.2
C#DK: prerelease 1.91.6
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 21, 2026 16:41
Co-authored-by: connor4312 <2230985+connor4312@users.noreply.github.com>
Co-authored-by: connor4312 <2230985+connor4312@users.noreply.github.com>
Co-authored-by: connor4312 <2230985+connor4312@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix conditional breakpoint list not updating dynamically Update conditional breakpoint list dynamically when breakpoints change Jan 21, 2026
Copilot AI requested a review from connor4312 January 21, 2026 16:50
@connor4312 connor4312 marked this pull request as ready for review January 21, 2026 17:37
Copilot AI review requested due to automatic review settings January 21, 2026 17:37
@connor4312 connor4312 enabled auto-merge (squash) January 21, 2026 17:37
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 21, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds dynamic updates to the conditional breakpoint "Wait for Breakpoint" dropdown list, ensuring it reflects breakpoint changes in real-time without requiring the widget to be closed and reopened.

Changes:

  • Extended the existing breakpoint change listener to update the trigger breakpoint dropdown when changes occur
  • Refactored breakpoint option building into a reusable buildBreakpointOptions() method
  • Added updateTriggerBreakpointList() to refresh the SelectBox while preserving user selection

Comment on lines +309 to +332
private buildBreakpointOptions(): ISelectOptionItem[] {
const breakpointOptions: ISelectOptionItem[] = [
{ text: nls.localize('noTriggerByBreakpoint', 'None'), isDisabled: true },
...this.availableBreakpoints.map(bp => ({
text: `${this.labelService.getUriLabel(bp.uri, { relative: true })}: ${bp.lineNumber}`,
description: nls.localize('triggerByLoading', 'Loading...')
})),
];

// Load the source code for each breakpoint asynchronously
for (const [i, bp] of this.availableBreakpoints.entries()) {
this.textModelService.createModelReference(bp.uri).then(ref => {
try {
breakpointOptions[i + 1].description = ref.object.textEditorModel.getLineContent(bp.lineNumber).trim();
} finally {
ref.dispose();
}
}).catch(() => {
breakpointOptions[i + 1].description = nls.localize('noBpSource', 'Could not load source.');
});
}

return breakpointOptions;
}
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The buildBreakpointOptions method has async operations that mutate option descriptions after the array is returned. While the SelectBox's lazy dropdown rendering will eventually show updated descriptions, there's a race condition: if a user opens the dropdown before async operations complete, they'll see "Loading..." descriptions. Consider awaiting all async operations before returning, or using a mechanism to notify when descriptions are ready.

Copilot uses AI. Check for mistakes.
@connor4312 connor4312 merged commit fe92fbb into main Jan 21, 2026
26 of 27 checks passed
@connor4312 connor4312 deleted the copilot/update-breakpoint-list-dynamically branch January 21, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conditional 'wait for breakpoint' list should update dynamically

3 participants