Home > front end >  `selectNextSuggestion` shortcuts for `show all commands` not work
`selectNextSuggestion` shortcuts for `show all commands` not work

Time:06-03

I set shortcut ctrl n and ctrl p for selectNextSuggestion and selectPrevioiusSuggestion. And I disable the shortcut ctrl n for workbench.action.files.newUntitledFile

After pressing ctrl shift p, all commands pops out with many suggestions. enter image description here

After pressing ctrl n , nothing happens. This is log meassage:

[2022-06-01 12:47:09.682] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
[2022-06-01 12:47:09.682] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
[2022-06-01 12:47:09.682] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
[2022-06-01 12:47:09.701] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: KeyN, keyCode: 78, key: n
[2022-06-01 12:47:09.701] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: KeyN, keyCode: 44 ('N')
[2022-06-01 12:47:09.702] [renderer1] [info] [KeybindingService]: | Resolving ctrl [KeyN]
[2022-06-01 12:47:09.702] [renderer1] [info] [KeybindingService]: \ From 1 keybinding entries, no when clauses matched the context.
[2022-06-01 12:47:09.911] [renderer1] [info] [KeybindingService]:   Ignoring single modifier ctrl due to it being pressed together with other keys.

If I change when expression of selectNextSuggestion to none. Still not working. This is log meassages:

[2022-06-01 12:52:50.564] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
[2022-06-01 12:52:50.565] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
[2022-06-01 12:52:50.566] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
[2022-06-01 12:52:50.584] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: KeyN, keyCode: 78, key: n
[2022-06-01 12:52:50.586] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: KeyN, keyCode: 44 ('N')
[2022-06-01 12:52:50.587] [renderer1] [info] [KeybindingService]: | Resolving ctrl [KeyN]
[2022-06-01 12:52:50.588] [renderer1] [info] [KeybindingService]: \ From 1 keybinding entries, matched selectNextSuggestion, when: no when condition, source: user.
[2022-06-01 12:52:50.798] [renderer1] [info] [KeybindingService]:   Ignoring single modifier ctrl due to it being pressed together with other keys.

(Arrow keys work fine but they are too far away.)

My question is: how can I make selectNextSuggestion shortcuts for show all commands work?

CodePudding user response:

I think the correct action for the commands palette is not selectNextSuggestion but workbench.action.quickOpenSelectNext

Therefore, the following keyboard shortcut config should work as intended :

  {
    "key": "ctrl n",
    "command": "workbench.action.quickOpenSelectNext",
    "when": "inQuickOpen"
  },
  {
    "key": "ctrl p",
    "command": "workbench.action.quickOpenSelectPrevious",
    "when": "inQuickOpen"
  }
  • Related