Microsoft/vscode

Explicitly foregrounding a window does not mark a window as most recent for window switching (alt-backtick) on macOS

Open

#195,442 创建于 2023年10月12日

在 GitHub 查看
 (2 评论) (1 反应) (1 负责人)TypeScript (10,221 fork)batch import
electronhelp wantedmacosupstreamworkbench-os-integration

仓库指标

Star
 (74,848 star)
PR 合并指标
 (平均合并 11小时 43分钟) (30 天内合并 1,000 个 PR)

描述

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version:
  • OS Version: macOS 14.0 (23A344)

Steps to Reproduce:

  1. Run the following:
mkdir A B C D
sleep 1 && code A
sleep 1 && code B
sleep 1 && code C
sleep 1 && code D
sleep 1 && code B
  1. Use command-backtick (⌘`) to switch windows in VS Code.
  2. Use command-backtick (⌘`) to switch windows in VS Code again.

Expected

Windows come to the forefront by the most time they were explicitly foregrounded (e.g. opened via the terminal or clicked), like in all other macOS apps:

  • D
  • C

Observed

Windows come to the forefront in the following order:

  • B
  • A

This is extremely unintuitive, especially if you have windows that were created hours ago. (It feels pretty much like a random window comes to the forefront instead of the one you want.)

It would seem that one workaround might be to reload a few windows together if you want them near each other in tab order. However, using code . in the shell or the "Reload Window" command does not work. The only way I found that works is to completely close and reopen the relevant windows, which may not be practical if you have long-running shell commands that could cost minutes or hours to re-start (e.g. long-running benchmarks, which are relevant to some projects I work on).

I don't know what VS Code is doing differently, but I think it would be a lot more intuitive to macOS users if the ⌘` order matched all other apps. In particular, it would allow the very common pattern of using ⌘` and ⌘⇧` to switch between two windows repeatedly (instead of having to press ⌘` arbitrarily often) by just opening them both again e.g. from Finder.

贡献者指南