How to disable codelens in VS code?
Visual Studio-CodeVscode SettingsVisual 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:
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
2- On right panel override setting "editor.codeLens" with "false" value.
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
Finally:
Workspace | Text Editor | (scroll down a little)
Solution 6 - Visual Studio-Code
For people using any Linux OS:
- Go to
File
>Preferences
>Settings
- Under drop-down
Text Editor
, search forCode 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.
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.