-
Notifications
You must be signed in to change notification settings - Fork 37.6k
Update conditional breakpoint list dynamically when breakpoints change #289429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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>
There was a problem hiding this 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
| 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; | ||
| } |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
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.
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
onDidChangeBreakpointslistener to callupdateTriggerBreakpointList()when in trigger point contextbuildBreakpointOptions()for reuseupdateTriggerBreakpointList()method refreshes SelectBox options while preserving current selection (or clearing it if the selected breakpoint was removed)Implementation
The SelectBox already supports dynamic updates via
setOptions(options, selectedIndex). Track available breakpoints inavailableBreakpointsarray and rebuild options on:Selection preservation uses breakpoint ID comparison to maintain UX continuity across updates.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.