Skip to content

Conversation

@Schpoone
Copy link
Contributor

Fixes #251241

Tested by running the reproduction steps listed in the issue.

When selecting different stack frames, the editor's focus stays on source if its focus was on source before and it stays on disassembly if its focus was on disassembly before.

When the debugger stops because of an instruction breakpoint or because of an instruction step, the focus will shift to the diassembly, but if different stack frames are inspected afterwards, you get the behavior above.

((threadStopReason === 'instruction breakpoint' && !preserveFocus) ||
(threadStopReason === 'step' && this.thread.lastSteppingGranularity === 'instruction' && !preserveFocus) ||
editorService.activeEditor instanceof DisassemblyViewInput)) {
return editorService.openEditor(DisassemblyViewInput.instance, { pinned: true, revealIfOpened: true });
Copy link
Member

Choose a reason for hiding this comment

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

I think we should just pass the preserveFocus boolean to the options argument here

Suggested change
return editorService.openEditor(DisassemblyViewInput.instance, { pinned: true, revealIfOpened: true });
return editorService.openEditor(DisassemblyViewInput.instance, { pinned: true, revealIfOpened: true, preserveFocus });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can include preserveFocus in the options, but that alone doesn't seem to fix the issue.

@connor4312 connor4312 enabled auto-merge (squash) July 8, 2025 16:02
@vs-code-engineering vs-code-engineering bot added this to the July 2025 milestone Jul 8, 2025
@connor4312 connor4312 merged commit 8f023e4 into microsoft:main Jul 8, 2025
17 checks passed
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Aug 24, 2025
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.

Editor should focus on source code when clicking on stack frames if the source code is currently focused

3 participants