Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger advanced hover information with keyboard

In vscode when I mouse hover on let's say, a method call or property it will display some information. I can trigger same thing with keyboard shortcut CMD+H (on mac).

Now with the mouse when I hover while holding the CMD key it will display more information. How to trigger this (CMD+mouse hover) equivalent with keyboard ?

(I'm aware of ALT+F12, but it's not exactly the same trigger.)

like image 443
Robert Brax Avatar asked Jun 06 '16 09:06

Robert Brax


2 Answers

Per official docs, the binding for 'Show Hover' is:

⌘K ⌘I

Remember that ⌘K is a 'chord', so do that first (Code will show "⌘K was pressed. Waiting for second key of chord..."), and then ⌘I.

Hope this helps. It's not the most elegant of bindings, but nothing to stop you changing it!

Note:-

For VSCodeVim users, this is: gh.

For Windows users, this is: Ctrl + K Ctrl + I

like image 88
Jack Clark Avatar answered Sep 19 '22 05:09

Jack Clark


This answer elaborates on Jack's helpful answer by pointing out the command palette command and how to override its shortcut.

Open the command palette and type "show hover" to find the command.

enter image description here

The default shortcut does not work for me, so I added an override of Ctrl + Space + H.

To add your own override, open the command palette and type "keyboard shortcuts". That opens the shortcut editor. This is how mine looks.

// Place your key bindings in this file to override the defaults [     {         "key": "ctrl+space ctrl+h",         "command": "editor.action.showHover",         "when": "editorTextFocus"     } ] 
like image 27
Shaun Luttin Avatar answered Sep 20 '22 05:09

Shaun Luttin