Click here to Skip to main content
15,880,608 members
Articles / Programming Languages / C#

What is CodeLens?

Rate me:
Please Sign up or sign in to vote.
4.75/5 (8 votes)
9 Jul 2014CPOL2 min read 149.4K   8   3
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)


Written By
Architect https://www.questpond.com
India India

Comments and Discussions

 
SuggestionSince I use 2015 community, looking for codelens solution Pin
Dinand.dotnet15-Aug-15 0:43
professionalDinand.dotnet15-Aug-15 0:43 
GeneralRe: Since I use 2015 community, looking for codelens solution Pin
Phillip H. Blanton18-Nov-18 17:12
Phillip H. Blanton18-Nov-18 17:12 
GeneralRe: Since I use 2015 community, looking for codelens solution Pin
Dinand.dotnet18-Nov-18 20:30
professionalDinand.dotnet18-Nov-18 20:30 
Thank you Philip for the fast reaction. After you thought 3+ years about the answer, a Developers lifetime has past and at least one VS version, your answer really helps. Thumbs Up | :thumbsup:
Wait till I'll solve your problem.
Regards Dinand

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.