microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.82k stars 29.12k forks source link

When actions.find has a "User" source, workbench.action.terminal.focusFind stops working #198904

Open DanKaplanSES opened 11 months ago

DanKaplanSES commented 11 months ago

Type: Bug

  1. Go to the keyboard shortcuts GUI
  2. Turn on record keys
  3. Press ctrl + F on your keyboard
  4. Modify actions.find's "When" expression to editorFocus || editorIsOpen || terminal.active
  5. Press enter to save your edit
  6. Modify actions.find's back to the way it was: editorFocus || editorIsOpen
  7. Press enter to save your edit. Note: The source column will still say "User"
  8. Open a terminal
  9. Press ctrl + F on your keyboard

Expected: workbench.action.terminal.focusFind executes, opening a search box in your terminal Actual: The keyboard shortcut has no effect

I turned on keyboard shortcut troubleshooting and it printed this:

log.ts:421  INFO [KeybindingService]: / Soft dispatching keyboard event
log.ts:421  INFO [KeybindingService]: \ Keyboard event cannot be dispatched
log.ts:421  INFO [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
log.ts:421  INFO [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
log.ts:421  INFO [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
log.ts:421  INFO [KeybindingService]: / Soft dispatching keyboard event
log.ts:421  INFO [KeybindingService]: | Resolving ctrl+F
log.ts:421  INFO [KeybindingService]: \ From 11 keybinding entries, matched actions.find, when: editorFocus || editorIsOpen, source: user.
log.ts:421  INFO [KeybindingService]: / Soft dispatching keyboard event
log.ts:421  INFO [KeybindingService]: | Resolving ctrl+F
log.ts:421  INFO [KeybindingService]: \ From 11 keybinding entries, matched actions.find, when: editorFocus || editorIsOpen, source: user.
log.ts:421  INFO [KeybindingService]: / Soft dispatching keyboard event
log.ts:421  INFO [KeybindingService]: \ Keyboard event cannot be dispatched
log.ts:421  INFO [KeybindingService]: + Ignoring single modifier ctrl due to it being pressed together with other keys.

VS Code version: Code 1.84.2 (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:51:52.184Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 2700X Eight-Core Processor (16 x 3700)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.93GB (23.43GB free)| |Process Argv|--disable-extensions --remote=wsl+Ubuntu| |Screen Reader|no| |VM|0%|
Extensions disabled
DanKaplanSES commented 11 months ago

Workaround: if you right-click on the keyboard shortcut setting and reset it, the row will go back to a "System" source and then ctrl + f will go back to behaving like normal.

ulugbekna commented 10 months ago

Hi @DanKaplanSES ,

This's an interesting find, thank you for the issue!


More details on why this is happening:

We first create a new keybinding and then remove the old keybinding. However, we then modify the keybinding we introduced, which if matches the unbound keybinding will be unbound. See:

https://github.com/microsoft/vscode/assets/16353531/87f62856-efb7-485b-8caf-78f819a5ca26