How to disable codelens in VS code?

2020-02-17 08:40发布

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.

7条回答
叛逆
2楼-- · 2020-02-17 08:49

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!

查看更多
戒情不戒烟
3楼-- · 2020-02-17 08:53

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

查看更多
Fickle 薄情
4楼-- · 2020-02-17 08:59

I disabled it by going to file | preferences | settings

file preferences settings

Finally:

Workspace | Text Editor | (scroll down a little)

enter image description here

查看更多
够拽才男人
5楼-- · 2020-02-17 09:05

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.

查看更多
Bombasti
6楼-- · 2020-02-17 09:06

You can Toggle CodeLens with the vscode-togglecodelens extension:

  1. Install vscode-togglecodelens extension
  2. Reload Visual Studio Code
  3. In Visual Studio Code command pallette, type "Toggle Codelens" to make Codelens appear or disappear

Gif: Toggle CodeLens without modifying settings files

查看更多
等我变得足够好
7楼-- · 2020-02-17 09:08

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

查看更多
登录 后发表回答