How to disable codelens in VS code?

Visual Studio-CodeVscode Settings

Visual Studio-Code Problem Overview


I've searched but didn't find any info on how to disable references (or the codelens completely) in the Visual Studio Code, they're quite useless and annoying for me.

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

You can enable or disable code lense by setting editor.codeLens to true or false in user settings (see https://code.visualstudio.com/Docs/editor/editingevolved#_reference-information for more info).

Solution 2 - Visual Studio-Code

Update: in the new settings editor of VSCode, it's as simple as typing codelens in the search and ticking the first checkbox in the results:

enter image description here


For me, the setting that fixed it was:

"editor.codeLens": false

in my user preferences json file.

Solution 3 - Visual Studio-Code

Step by step:

1- Press CTRL+SHIFT+P and search for "User Settings", and open settings.json file. This file sits under:

%UserProfile%\AppData\Roaming\Code\User\settings.json

CTRL+SHIFT+P

2- On right panel override setting "editor.codeLens" with "false" value.

editor.codeLens

Solution 4 - Visual Studio-Code

To specifically disable the references in the C# editor, add this to your User Settings:

"csharp.referencesCodeLens.enabled": false

This specifically hides the number of references in the C# editor while keeping the rest of CodeLens' features intact.

MotKohn also pointed out that you can use javascript.referencesCodeLens.enabled or typescript.referencesCodeLens.enabled below. Make sure you give them some points if that helped!

Solution 5 - Visual Studio-Code

I disabled it by going to file | preferences | settings

file preferences settings

Finally:

Workspace | Text Editor | (scroll down a little)

enter image description here

Solution 6 - Visual Studio-Code

For people using any Linux OS:

  1. Go to File > Preferences > Settings
  2. Under drop-down Text Editor, search for Code Lens and disable it.

Solution 7 - Visual Studio-Code

You can do it using a single click on VS Code. Just install the extension Setting Toggle made by Ho-Wan on VS Code. Once you install, click on T as shown in the image to toggle Codelens.

enter image description here

Solution 8 - Visual Studio-Code

Shortcut to toggle this feature on/off quickly: CTRL+SHIFT+P Toggle TypeLens

Solution 9 - Visual Studio-Code

The editor.codeLens property doesn't seem to work for F#, at least for the inline type-annotation lens. I needed to set:

"FSharp.inlayHints.typeAnnotations": false

to disable it.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPhoeraView Question on Stackoverflow
Solution 1 - Visual Studio-CodeBenjamin PaseroView Answer on Stackoverflow
Solution 2 - Visual Studio-CodethedayturnsView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeTeoman shipahiView Answer on Stackoverflow
Solution 4 - Visual Studio-CodeCodeaculaView Answer on Stackoverflow
Solution 5 - Visual Studio-CodeLuke GarriganView Answer on Stackoverflow
Solution 6 - Visual Studio-CodeChwizdoView Answer on Stackoverflow
Solution 7 - Visual Studio-CodeCircuit BreakerView Answer on Stackoverflow
Solution 8 - Visual Studio-CodeGraeme WickstedView Answer on Stackoverflow
Solution 9 - Visual Studio-CodeRolyView Answer on Stackoverflow