83

Is there a keyboard shortcut to trigger the information tooltip that is typically shown when hovering over items in VS Code with the mouse?

Example hover tooltip:

Example hover tooltip

Herohtar
  • 5,347
  • 4
  • 31
  • 41
Artsiom Miksiuk
  • 3,896
  • 9
  • 33
  • 49
  • Does this answer your question? [How to trigger documentation popup in VS Code?](https://stackoverflow.com/questions/47455756/how-to-trigger-documentation-popup-in-vs-code) – starball Aug 12 '23 at 02:00

6 Answers6

96

Press Ctrl + K, Ctrl + I, that's what you want

Anil
  • 1,097
  • 7
  • 20
newbee vscode
  • 984
  • 7
  • 3
  • 8
    This doesn't work with `vim` mode plugin. The solution is to rebind to another keys like in IntelliJ Idea: `CTRL`+`F1` – 18augst Oct 13 '18 at 18:44
  • 2
    This worked for me on Mac + Vim plugin. The trick is timing. Put the cursor over the type, hold CMD/Ctrl + press K. At this point you should see "(CMD K) was pressed. Waiting for second key of chord..." at the bottom bar. At this point continue holding CMD/Ctrl and press i. – Lucas Lago Dec 19 '18 at 00:03
  • 9
    It's a `Ctrl+K` and then `Ctrl+I`, **not** `Ctrl+K+I`. I edited the original answer, I hope the edition will be accepted – kanlukasz Dec 18 '20 at 08:16
  • 1
    @18augst I'm using the Vim plugin in VSCode and it works. As the previous comment mentions, the correct shortcut is `Ctrl + K` then `Ctrl + I`. Or hold `Ctrl`, then tap `K` and `I` consecutively. – Advait Junnarkar Dec 21 '21 at 05:15
  • Would also suggest remapping `extension.vim_ctrl+n` to `` and `extension.vim_ctrl+p` to `` so you can scroll up and down this popup menu more conveniently than using / . iirc `` already works "out the box" to navigate down this menu but ` – amy Jan 08 '23 at 22:02
  • Works except during debugging mode. It doesn't show up with Cmd+K, Cmd+I on mac. Maybe it is intended? – Lebannen May 03 '23 at 06:34
88

If you're using the VSCodeVim plugin, you can use gh to show the tooltip.

alaq
  • 1,006
  • 7
  • 4
49

The corresponding cmd name in VS Keybindings is editor.action.showHover. On mac for me the key combo was:

⌘ Command + k

⌘ Command + i

You can also access it through your command palette by typing show hover. It will show you the current keybinding and you can execute it as well.

If you would like you can remap it like this:

{
    "key": "ctrl+e",
    "command": "editor.action.showHover",
    "when": "editorTextFocus"
}

With that, if your cursor is within an error/warning squiggly line, you can hit ctrl+e to show what you would normally see with hover.

To make the box disappear, I am having to hit escape. It would be cool if there was a editor.action.toggleHover or something like that, but in the meantime this works great!

golopot
  • 10,726
  • 6
  • 37
  • 51
protoEvangelion
  • 4,355
  • 2
  • 29
  • 38
  • 1
    When I move mouse out, tooltip is gonna hide :-( I don't understand how to prevent it – Atombit Nov 25 '19 at 13:39
  • 2
    Any solution in mind to work like as long a key (for example ctrl) is being held it shows, when released disappears? - Like how it does when you actually hover on it with mouse - if you hover on a function, and press ctrl, it shows the definition, if you release ctrl, it disappears. So in my example it would work exactly the same, just instead of mouse hover, it would do it when `editorTextFocus` – Gergő Horváth Dec 08 '19 at 18:19
6

2021 Update- As far as I can tell, the new command that we're all looking for here is:

"Show Definition Preview Hover"

The shortcut for that command was unbound. I set it back to ctrl+h, which is what worked for me in the past. Here's more info-

https://newbedev.com/how-to-trigger-documentation-popup-in-vscode

chrismarx
  • 11,488
  • 9
  • 84
  • 97
5

You could use Ctrl + Shift + M to show all the errors:

enter image description here

and then use Ctrl + . to show the list of the Quick Fixes.

Nasreddine
  • 36,610
  • 17
  • 75
  • 94
  • 4
    The question was asking for how to show the tooltip, not just how to see all the errors or quick fixes. The tooltip can show other kinds of information, such as variable type, method signature, etc. – Herohtar Mar 15 '20 at 23:15
  • 2
    while this isn't an answer to the question this did make it easier for me to use my mouse a little less. Great suggestion! – Eddy Vinck Aug 06 '20 at 08:34
-1

A simple way, which is also on the official site of Microsoft, is the simultaneous use of ctr + k + i are together.

Just make sure the cursor is on the desired area