Missing CodeLens references count in Visual Studio

2019-01-16 09:28发布

  1. Is there a reason why the references count (code lens) is missing in Visual Studio Community edition?
  2. Is is possible to enable it in the options?

Here is a screenshot of Visual Studio 2015 and 2017 Community edition:

methods without code lens

Here is a screenshot of Visual Studio 2013:

methods with code lens

source: dailydotnettips.com

6条回答
萌系小妹纸
2楼-- · 2019-01-16 09:59

This feature has been disabled in Visual Studio Community 2017, although it sounds like it was temporarily available in pre-release versions.

The Visual Studio Team issued this statement on the 14th of March 2017:

An authoring error in the SQL Server Data Tools resulted in the capability temporarily showing up incorrectly in Visual Studio Community when installed; the change you see is a result of correcting that mistake.

Also, on the Compare Visual Studio 2017 Offerings page CodeLens appears to not be available in the Community edition.

查看更多
Ridiculous、
3楼-- · 2019-01-16 10:01

I'm not allowed to Comment on R. Richards answer above, so posting this as a separate answer: CodeLens references disappeared for me too when I upgraded my VS Pro to 2017. But only on my Desktop ("same" upgrade behaved differently on my laptop, where CodeLens settings apparently unaffected). Anyway, very easy to resolve just Enable CodeLens under Text Editor : All Languages

查看更多
何必那么认真
4楼-- · 2019-01-16 10:03

I installed the latest SSDT preview for Visual Studio 2015 from the link below on 2 machines I have with VS 2015 Community edition (Update 1), and CodeLens started working for all my projects.

https://msdn.microsoft.com/en-us/library/mt204009.aspx

enter image description here

查看更多
可以哭但决不认输i
5楼-- · 2019-01-16 10:13

I have Visual Studio 2015 Community edition and it originally did NOT have CodeLens.

However, after going to Tools -> Extensions and Updates -> Product Updates and then downloading SSDT and installing all options within the SSDT package, my VS 2015 Community Edition now miraculously has access to CodeLens.

查看更多
beautiful°
6楼-- · 2019-01-16 10:15

An alternative is to just right-click the member and select 'Find All References' or the hot key shift + F12*. Not only you will find the count of references grouped by project, but also the underlying code lines and their classes.

* As per Visual Studio 2017 Community.

查看更多
劳资没心,怎么记你
7楼-- · 2019-01-16 10:21

This isn't a generic reference counting feature, it's just one of the features of CodeLens. CodeLens is only available in Visual Studio 2015 Pro and above. In Visual Studio 2013 it was a Ultimate-only feature.

UPDATE

As others have noted, installing SSDT or SSMS 2016 may enable CodeLens as well. That's because VS 2015 Community is Pro, with a different license and some missing extensions like CodeLens. As long as an extension's binaries and settings are installed, Community will activate the extension.

查看更多
登录 后发表回答