yigal
yigal

Reputation: 4715

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?

Upvotes: 4

Views: 1582

Answers (2)

starball
starball

Reputation: 50194

At the time of this writing, there is no such feature.

See also issue ticket Allow an option to only show hovers if a shortcut key is down #43857.

If the hovers are getting in your way, you at least have the option to work around the issue using the editor.hover.delay setting.

Upvotes: 0

Mark
Mark

Reputation: 180825

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.

Upvotes: 7

Related Questions