Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

in vscode, can I have the hover information only when press the alt key?

I am just getting started with using vscode. I noticed that when I hover the mouse over the text and squiggly lines, I get some extended information. this can be useful at time, but most often it is distracting. I know how to disable the hover all together using settings (Editor > Hover: Enabled), but I want something easier, like enabling hover only when I press the Alt key

is it at all possible with vs code. maybe with an extension?

like image 699
yigal Avatar asked Sep 19 '25 18:09

yigal


1 Answers

As clarified in your comment below, here is another approach. You will need the toggle extension made by one of the vscode team members. In your keybindings.json:

{
  "key": "alt+z",
  // "key": "alt+capslock",

  "command": "toggle",
  "when": "editorTextFocus",

  "args": {
    "id": "hover",
    "value": [
      {
        "editor.hover.enabled": true
      },
      {
        "editor.hover.enabled": false
      }
    ]
  }
},

Now you push Alt+z once to turn hover on and you can over over whatever you want, and Alt+z again to turn off hover.

hover toggle

When you toggle it on, you do have to move the mouse ever so slightly to trigger it to show the hover of the thing you are over. Toggling it off happens immediately.

You still can't use just Alt because it is a modifier key - and must have something to modify. See https://code.visualstudio.com/docs/getstarted/keybindings#_accepted-keys for can be used with a modifier key: Alt+capslock works for example.

like image 128
Mark Avatar answered Sep 23 '25 07:09

Mark