Saad
Saad

Reputation: 53799

How can I toggle inlay hints in VS Code?

In the latest version of VSCode, the default settings have changed and inline parameter hints are always shown in the code despite me not using any setting for it. How do I disable them?

Example (predicate and searchString):

enter image description here

Upvotes: 67

Views: 38606

Answers (4)

starball
starball

Reputation: 50074

You can use the editor.inlayHints.enabled setting. Quoting from the default settings pseudo file:

// Enables the inlay hints in the editor.
//  - on: Inlay hints are enabled
//  - onUnlessPressed: Inlay hints are showing by default and hide when holding Ctrl+Alt
//  - offUnlessPressed: Inlay hints are hidden by default and show when holding Ctrl+Alt
//  - off: Inlay hints are disabled
"editor.inlayHints.enabled": "on",

Note that if you want to control the setting on a per-language basis, there are at least two options. One option is to wrap the setting in a language block, like so (example with TypeScript):

"[typescript]": {
    "editor.inlayHints.enabled": "off"
}

The other option for per-language configuration is to check if the extension you're using which contributes inlay hints for that particular language has any settings for controlling it (see also the extension API docs for InlayHintsProvider<T>). Several extensions enable you to control enablement at a finer level / toggle inlay hints contributed specifically by that extension. To do that, just search "inlayhints" in your settings.json or settings UI. Here are a couple of examples of such extension-specific settings:

There are also several other related settings for controlling appearance of inlay hints such as font, and in the colour customizations setting, their colouring and font style. Just search for them in the settings UI or trigger suggestions in settings.json to find them. Or see {language,extension}-independent VS Code inlay hint customization.


Note that if you're seeing a "Double-click to insert" prompt over these, that's also part of the inlay hints features. Extensions can give InlayHints a textEdit, which is what enables this.

Upvotes: 6

Fabio Mendes Soares
Fabio Mendes Soares

Reputation: 1405

In the most recent Visual Studio Code, I could find this option under Preferences: Open Settings UI, after pressing ctrl + shift + P.

Ctrl+Shift+P

Then, find the option Inlay Hints Enabled and set it to off.

Inlay Hints Enabled off

This solved the problem here for me.

Upvotes: 2

Saad
Saad

Reputation: 53799

You can disable this new default setting by putting this option in your settings.json file:

"editor.inlayHints.enabled": "off"

The full list of available settings are:

  • off
  • offUnlessPressed
  • on
  • onUnlessPressed

Upvotes: 99

Zeeshan Saeed
Zeeshan Saeed

Reputation: 261

To disable this setting follow these steps :

Step 1: First you need to open 'setting.json'

        ( CTRL + SHIFT + P and type "Open Settings (JSON)" and click the 
          matching entry )
        

Step 2: Add this code in 'setting.json'

         "editor.inlayHints.enabled": "off"

enter image description here

Upvotes: 17

Related Questions