Stepping sometimes causes focus to pass to another thread

Open
#322,448 3 comments 0 reactions 1 assignee View on GitHub

@connor4312 is already working on this.

Since Jun 22, 2026.

Assessment

This issue has not been assessed yet.

Description

bug debug

Type: Bug

When I step in a multi-target debugging scenario, the source code and call stack should remain focused on the debug session/thread that I am stepping in. I am noticing that sometimes that is true, and sometimes the focus swaps to another debug session/thread that is stopped.

For context, I am maintaining a custom debug adapter that performs remote debugging, so stepping can often take longer than 800ms. The behavior that I expect seems to conflict with the behavior that was introduced in these issues/commits and their followups:

In order to keep both of these behaviors, here are some ideas:

  • Create a user setting to choose whether focus should be automatically passed to another thread or not when the current one starts running
  • Create a user setting to adjust the timeout for the automatic focus passing
  • Add a new DAP property for StoppedEvent or use the existing "preserveFocusHint" to change focus back to the stopped thread if the focus has been passed away

Let me know if you want me to recreate this with the Mock Debug Adapter.

VS Code version: Code 1.123.0 (6a44c352bd24569c417e530095901b649960f9f8, 2026-06-03T11:29:03+02:00)
OS version: Linux x64 7.0.11-arch1-1
Modes:

System Info
Item Value
CPUs AMD Ryzen 7 5800X 8-Core Processor (16 x 4541)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x10de [Google Inc. (Mesa)], DEVICE=0x1cb6 [ANGLE (Mesa, NV137, OpenGL ES 3.2 Mesa 26.1.2-arch1.1)], DRIVER_VENDOR=Mesa, DRIVER_VERSION=26.1.2 ACTIVE
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgpu: enabled
webgpu_on_vk_via_gl_interop: disabled_off
webnn: disabled_off
Load (avg) 6, 7, 7
Memory (System) 62.70GB (36.85GB free)
Process Argv --crash-reporter-id 7d5ad6ef-34f6-4670-aa76-057c6dedc880
Screen Reader no
VM 0%
DESKTOP_SESSION hyprland
XDG_CURRENT_DESKTOP Hyprland
XDG_SESSION_DESKTOP hyprland
XDG_SESSION_TYPE wayland
A/B Experiments
vsliv368cf:30146710
pythonvspyt551:31249599
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
6abeh943:31336334
envsdeactivate2:31505458
cloudbuttont:31379625
3efgi100_wstrepl:31403338
bj468946:31457056
ec5jj548:31422691
diffpatch-lysithea-0013-aggr-1-3:31530305
cp_cls_t_966_ss:31526232
4je02754:31466945
8hhj4413:31478653
ge8j1254_inline_auto_hint_haiku:31490510
38bie571_auto:31478677
cp_cls_t_1081:31454832
conptydll_true:31498968
ia-use-proxy-models-svc:31452481
e9c30283:31461165
test_treatment2:31471001
46204921:31447328
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
nes-extended-on:31455476
chat:31457767
8hig5102:31480529
ah:31461780
89g7j272:31518289
7e187181:31503455
i2gc6536:31499202
52612955:31516516
ghj88844:31499326
ec1eg703:31520046
ddid_t:31478206
hmra_i5g22:31518061
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
db5d2638:31499441
jb_cp_cls_t_632:31537244
b1ei0813:31506238
56dj4588:31512888
32d76977:31512328
ha629193:31508444
cdk-lw-on:31524445
31fi7170_t:31522396
g4a0e106:31529594
prpt_srch:31518468
jbcp_cls_pctr_t:31531130
61138546:31518536
cp_intellij_t_nes:31533504
d7b18187:31526828
h561g132:31533256
ihg5j128:31534457

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.