Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

What is CodeLens?

4.75/5 (8 votes)
9 Jul 2014CPOL2 min read 151.5K  
In this blog, we will discuss about CodeLens, a new feature of Visual Studio 2013.

Code lens is a new feature in Visual Studio 2013 which helps us to understand three important things about our code while we are coding inside Visual Studio.

All these three things (Impact, test and latest) are seen right above your class / method when you code in Visual Studio as shown in the below figure:

Image 1

Impact: First thing code lens shows is when we change the code what is the impact of those changes. For instance, in the above figure, you can see it stating that if you make any changes to the log method, it will be impact 1 reference.

If you click on references further, it will also show which classes it’s referencing. With this, we come to know the level of impact this change will have further.

In the below screen, it’s stating that “ConsoleApplication2” and “UnitTest1.cs” are the classes.

Image 2

If you further click on “Show on Code Map” menu you should see a graphical representation of dependencies.

Image 3

Test: Second important thing code lens tells is whether this method was unit tested or not. For instance, you can see it says 1 passing means this method was unit tested.

Image 4

Latest: Third thing it tells whether this is a latest code or not. You can see the last menu which states this is not a latest code and you need to do a get latest from the server.

But now for the bad news nothing is free, code lens is currently available only in ultimate edition. Wish it was free as air….. ;-)

Image 5

Below is a nice and short video of codelens created by www.questpond.com team.

Image 6

For further reading do watch the below interview preparation videos and step by step video series.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)