When I execute the command Peek References
above a class for example, it opens up a peek window. How do I close it using a keyboard shortcut?
There are other peeks as well like Git: View Changes
that opens a similar preview. How do I close that previews with this type of style in general using a keyboard shortcut (meaning a custom command that I can map a mapping to)?
When I execute the command Peek References
above a class for example, it opens up a peek window. How do I close it using a keyboard shortcut?
There are other peeks as well like Git: View Changes
that opens a similar preview. How do I close that previews with this type of style in general using a keyboard shortcut (meaning a custom command that I can map a mapping to)?
1 Answer
Reset to default 0In general, Escape will close alot of vscode's various pop-up windows and views. In the particular case of Peek References
the command you would rebind is
{
"key": "escape", // put your new command here
"command": "closeReferenceSearch",
"when": "editorTextFocus && referenceSearchVisible && !config.editor.stablePeek || referenceSearchVisible && !config.editor.stablePeek && !inputFocus"
}
Since I knew Escape would close that peek widget, I first ran the Palette Command Developer: Toggle Keyboard Shortcuts Troubleshooting
. Then open a peek references window, hit Escape, and looked at the Output
to see which command (and its when
clause) was triggered.