Skip to content

Use preserveFocus when focusing stack frames #251964

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

Merged
merged 3 commits into from
Jul 8, 2025

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' ||
(threadStopReason === 'step' && this.thread.lastSteppingGranularity === 'instruction') ||
((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
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.

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