如何在 C# 中禁用 CodeLens 的引用显示 [英] How to disable CodeLens' references display in C#

查看:43
本文介绍了如何在 C# 中禁用 CodeLens 的引用显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注 .我相信现在是向 Microsoft 发送有关此主题的反馈的最佳时机,它们处于发布之间.

I'm following a certain thread suggesting a certain approach. As the image below shows, one can't disable the feature Show References for all languages.

When I discovered that, I tried to do that for C# alone (since that's the only language I code in where the listed references' count is an annoyance). However, as far I can see, there's nothing about CodeLens under C# specifically.

Do I need to turn off the whole CodeLens thingy or is there a way to disable aforementioned option only?

解决方案

Show References does a lot of heavy lifting for all the other lenses. It constructs the call tree that's used to compute the Tested By/Tests relation as well as the reference count and the Test Status. As such it cannot be disabled without turning off the other options.

There is currently no way to disable CodeLens on a per-language basis. Currently CodeLens only supports VB.NET and C# and it's an all-or-nothing thing, since it depends on Roslyn under the hood no other languages are currently supported.

Apart from doing that heavy lifting, the Reference Indicator is also put in place as a placeholder to prevent the editor from "stuttering" while the other lenses are loading. In an early beta it worked that way and that was incredibly annoying. There has been a version where they showed just empty space, and that was quickly replaced by always showing the reference indicator. Both because it should always be available and also because it's quick to compute and available offline.

I suggest you file a specific request for the changes you want to see on the Visual Studio User Voice. I believe now is the perfect time to send Microsoft feedback on this topic, they're in between releases.

这篇关于如何在 C# 中禁用 CodeLens 的引用显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆