Skip to content

testing: respect keybindings before type-to-filter - #344892

Merged
Connor Peet (connor4312) merged 2 commits into
microsoft:mainfrom
wozhenbang2004:fix-testing-keybindings-344598
Oct 29, 2026
Merged

Connor Peet (connor4312) merged 2 commits into
microsoft:mainfrom
wozhenbang2004:fix-testing-keybindings-344598

Conversation

@wozhenbang2004

Copy link
Copy Markdown
Contributor

Fixes #344598.

The Test Explorer handles printable keydown events before normal command dispatch. Even when soft dispatch has found a user shortcut, its listener replaces the filter text and focuses the filter input, invalidating the shortcut's tree-focus context before the command can execute.

Inject IKeybindingService into the existing view model and start type-to-filter only when softDispatch returns NoMatchingKb. Matching commands and chord prefixes keep their current focus and filter text; unbound printable keys still start filtering.

Five DOM-level cases render TestingExplorerView with controlled keybinding-resolution results. They cover j/k/o, a chord prefix, unchanged existing filter text and tree focus, and the unbound printable-key fallback. The fixture reuses workbench test services and owns its created UI resources.

Validation on Linux, Node 24.22.1, using the repository Electron runner:

  • Four shortcut/chord regressions fail against the original production code; the unbound-key control passes.
  • Fixed view plus related tree/list projection and filter-state suites: 31 passing.
  • Client transpilation (npm run build-fast -- --client-only), changed-file ESLint, hygiene, and git diff --check passed.
./scripts/test.sh --no-sandbox --ozone-platform=headless --disable-gpu \
  --run src/vs/workbench/contrib/testing/test/browser/testingExplorerView.test.ts \
  --run src/vs/workbench/contrib/testing/test/browser/explorerProjections/treeProjection.test.ts \
  --run src/vs/workbench/contrib/testing/test/browser/explorerProjections/nameProjection.test.ts \
  --run src/vs/workbench/contrib/testing/test/common/testExplorerFilterState.test.ts \
  --reporter dot --timeout 10000 --stall-timeout 60

The Electron flags are for the headless container. These tests exercise the actual view's DOM focus and filter behavior with stubbed resolution results; they do not exercise the full user-keybinding resolver or establish Windows manual coverage.

AI-assisted implementation and local validation.

Keep matching keybindings and chord prefixes from overwriting the Testing filter and moving focus before command dispatch. Unbound printable keys continue to start filtering.

AI-assisted implementation and local validation.
Render TestingExplorerView and dispatch DOM keydown events with controlled keybinding resolutions. Cover j/k/o shortcuts, chord prefixes, unchanged filter text and tree focus, plus the unbound printable-key fallback.

Four regression cases fail on the original code. The fixed view and related projection/filter suites pass all 31 tests. AI-assisted implementation and local validation.
Copilot AI balanced review requested due to automatic review settings October 29, 2026 03:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the change making Test Explorer honor matching keybindings before activating type-to-filter.

No open issues 🎉

What changed in this PR

Fixes #344598 by making Test Explorer respect matching keybindings before starting type-to-filter, preserving tree focus so custom shortcuts can execute.

Changes:

  • Injects the keybinding service into the view model and starts filtering only when soft dispatch returns NoMatchingKb.
  • Adds five DOM-level regression cases covering printable shortcuts, chord prefixes, preserved filter text and focus, and unbound-key filtering.

No actionable findings remain. The tests use controlled resolution results; they do not cover the full keybinding resolver or Windows-specific behavior.

File Description
src/​vs/​workbench/​contrib/​testing/​test/​browser/​testingExplorerView.test.ts Adds shortcut, chord-prefix, and unbound-key regression tests.
src/​vs/​workbench/​contrib/​testing/​browser/​testingExplorerView.ts Checks keybinding resolution before activating type-to-filter.

Review effort: Balanced

@connor4312 Connor Peet (connor4312) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks!

@connor4312
Connor Peet (connor4312) merged commit ce91696 into microsoft:main Oct 29, 2026
55 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.145.0 milestone Oct 29, 2026
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.

Test Explorer type-to-filter steals focus before custom printable-key shortcuts execute

5 participants