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.
问题:
回答1:
You can enable or disable code lense by setting the editor.codeLens
setting in user settings (see https://code.visualstudio.com/Docs/editor/editingevolved#_reference-information for more info).
回答2:
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.
回答3:
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.
回答4:
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!
回答5:
I disabled it by going to file | preferences | settings
Finally:
Workspace | Text Editor | (scroll down a little)
回答6:
You can Toggle CodeLens with the vscode-togglecodelens extension:
- Install vscode-togglecodelens extension
- Reload Visual Studio Code
- In Visual Studio Code command pallette, type "Toggle Codelens" to make Codelens appear or disappear
Gif: Toggle CodeLens without modifying settings files
回答7:
Shortcut to toggle this feature on/off quickly: CTRL+SHIFT+P
Toggle TypeLens