How to disable references (CodeLens) in VS Code

avatar
Borislav Hadzhiev

Last updated: Apr 6, 2024
3 min

banner

# Table of Contents

  1. How to disable references (CodeLens) in VS Code
  2. Disabling references (CodeLens) in settings.json
  3. Disabling specific references in VS Code
  4. Disable the MDN References in VS Code
  5. Disable all hover references in VS Code

# How to disable references (CodeLens) in VS Code

References in VS Code are a feature that comes with CodeLens.

reference in vscode

The yellow arrow points to a reference count.

You can disable them by disabling CodeLens or disabling specific references.

To disable CodeLens completely:

  1. Press Ctrl + Shift + P (or Command + Shift + P on macOS).
Note: you can also press F1 to open the Command Palette.
  1. Type user settings and select Preferences: Open User Settings.

open user settings

  1. Type editor codelens and untick the Editor: Code Lens checkbox.

disable code lens

You can also open the settings screen by pressing Ctrl + , on Windows and Linux or Cmd + , on macOS.

Once you uncheck the checkbox, the references are no longer shown.

# Disabling references (CodeLens) in settings.json

You can also disable references (CodeLens) directly in your settings.json file.

  1. Press Ctrl + Shift + P (or Command + Shift + P on macOS).
Note: you can also press F1 to open the Command Palette.
  1. Type user settings json.

  2. Click on Preferences: Open User Settings (JSON)

preferences open user settings

  1. Set the "editor.codeLens" property to false in the object.
settings.json
{ "editor.codeLens": false, }

set editor codelens to false

# Disabling specific references in VS Code

If you need to disable specific references:

  1. Press Ctrl + Shift + P (or Command + Shift + P on macOS).
Note: you can also press F1 to open the Command Palette.
  1. Type user settings and select Preferences: Open User Settings.

open user settings

  1. Type referencesCodeLens and untick the references you want to disable.

disable specific references

# Disable the MDN References in VS Code

You might also need to disable the MDN hover references in VS Code.

mdn references in vs code

When you hover over an HTML tag or a method, you get some information from the MDN docs.

If you'd rather disable the MDN references:

  1. Press Ctrl + Shift + P (or Command + Shift + P on macOS).
Note: you can also press F1 to open the Command Palette.
  1. Type user settings and select Preferences: Open User Settings.

open user settings

You can also open the settings screen by pressing Ctrl + , on Windows and Linux or Cmd + , on macOS.

  1. Type mdn and uncheck the checkboxes.

disable only mdn references

Once you disable the setting, the MDN references are no longer shown.

mdn references disabled

When the MDN references are disabled, you will still get helpful information when you hover over a method or a CSS function.

hover hints are still enabled

# Disable all hover references in VS Code

If you'd rather disable all hover references.

  1. Press Ctrl + Shift + P (or Command + Shift + P on macOS).
Note: you can also press F1 to open the Command Palette.
  1. Type user settings and select Preferences: Open User Settings.

open user settings

You can also open the settings screen by pressing Ctrl + , on Windows and Linux or Cmd + , on macOS.

  1. Type editor hover enabled and uncheck the checkbox.

disable mdn references

When you hover over a tag or a method, you will no longer get pop-ups.

all hover references disabled

I've also written an article on how to disable/enable hover hints (tooltips) in VS Code.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.