For example, in VS Code, I can right click on a variable, select Peek > Peek Type Definition.
How can I make a keybinding for this (currently there is no keybinding set)? How can I even find the appropriate command for the keybindings.json file, if the "Peek Type Definition" button is not mapped to anything?
CodePudding user response:
Go to the Gear Icon in the lower right. click it and select Keyboard Shortcuts
. It will open the Keyboard Shortcuts editor.
In that editor's input box at the top, type peek type
and you will get 2 entries shown. One is:
Peek Type Definition
editor.action.peekTypeDefinition
That command does not have a default shortcut, but you can make one yourself.
If you hover over that entry, a
sign will appear to its left, click it and an input dialog opens where you can enter your chosen keybinding.
It will make a keybinding in your keybindings.json
like
{
"key": "alt 5", // whatever you chose here
"command": "editor.action.peekTypeDefinition"
}
CodePudding user response:
When you right click, the window that pops up is called the context menu. Some keyboards have a context menu button. Unfortunately, VSCode does not use this as the command in the keyboard shortcuts, so there is no way to do this through the keyboard shortcuts menu.