我已经搜索过了,但没有找到任何关于如何在VisualStudio代码中禁用引用(或完全禁用代码)的信息,它们对我来说非常无用和烦人。
您可以通过在用户设置中将editor.codeLens设置为true或false来启用或禁用代码透镜(有关详细信息,请参阅https://code.visualstudio.com/docs/editor/editingevolved#_reference-information)。
editor.codeLens
true
false
更新:在VSCode的新设置编辑器中,只需在搜索中键入CodeLens并勾选结果中的第一个复选框即可:
对我来说,修复它的设置是:
"editor.codeLens": false
在我的用户首选项JSON文件中。
一步一步:
1-按Ctrl+Shift+P并搜索“用户设置”,然后打开settings.JSON文件。 此文件位于:
%UserProfile%\AppData\Roaming\Code\User\settings.json
2-在右侧面板上,用“假”值覆盖设置“编辑器.codelens ”。
快速打开/关闭此功能的快捷方式:CTRL+SHIFT+PToggle TypeLens
CTRL+SHIFT+P
Toggle TypeLens
要在C#编辑器中明确禁用引用,请将以下内容添加到用户设置中:
"csharp.referencesCodeLens.enabled": false
这特别隐藏了C#编辑器中的引用数量,同时保持CodeLens的其余特性不变。
莫特科恩还指出,可以使用下面的javascript.referencesCodeLens.enabled或typescript.referencesCodeLens.enabled。如果有帮助的话,一定要给他们一些分数!
javascript.referencesCodeLens.enabled
typescript.referencesCodeLens.enabled
我通过file | preferences | settings禁用了它。
file | preferences | settings
最后:
Workspace | Text Editor | (scroll down a little)
对于使用任何Linux操作系统的人:
File
Preferences
Settings
Text Editor
Code Lens
完成。只需在VS代码上安装Ho-Wan制作的扩展Setting Toggle。 安装后,单击测试(如图所示)以切换CodeLens.
Setting Toggle
editor.codeLens属性似乎不适用于F#,至少不适用于内联类型注释透镜。我需要设置:
"FSharp.inlayHints.typeAnnotations": false
使其失效。