Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing CodeLens references count in Visual Studio Community edition 2015 and 2017

  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

like image 412
H. Pauwelyn Avatar asked Oct 15 '15 09:10

H. Pauwelyn


People also ask

How do I enable CodeLens in Visual Studio?

CodeLens is available in Visual Studio Community edition, however, the source control indicators are not available in this edition. To choose the indicators that you want to see, or to turn CodeLens off and on, go to Tools > Options > Text Editor > All Languages > CodeLens.

How do I see references in Visual Studio?

You can use the Find All References command to find where particular code elements are referenced throughout your codebase. The Find All References command is available on the context (right-click) menu of the element you want to find references to. Or, if you are a keyboard user, press Shift + F12.

What is CodeLens in Visual Studio?

With Microsoft Visual Studio 2019 version 16.1, P4VS supports the CodeLens feature. With the relevant CodeLens option enabled (which is the default), you can view the names of users who made changes to classes, functions, and methods throughout the code and get a preview of up to five changelists.


2 Answers

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

like image 80
R. Richards Avatar answered Oct 09 '22 10:10

R. Richards


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.

UPDATE 2019

"CodeLens has been a feature found only in Visual Studio Enterprise, but that will change in an upcoming preview of Visual Studio 2019, when it will also be available for the Community edition, likely in 2019" What's New in Visual Studio 2019

like image 27
Panagiotis Kanavos Avatar answered Oct 09 '22 10:10

Panagiotis Kanavos