VisualStudio

CodeLens in VisualStudio 2013

Posted on

CodeLens is a feature that will be available only in Visual Studio Ultimate edition (more on the controversy here), but adds some very useful behavior to the editor. By default, the number of times a property or method is referenced by your code is shown above that property or method. This information can be helpful when changing existing code, since you’ll know if the method is called from many places or just a handful. In larger projects, especially ones where you’re not familiar with the entire codebase, this can be a big time saver. The number of references is shown in a small font above each property or method on your class, as shown in below figure. Clicking on the number of references will show you all of the methods that call it, making it easy to find and navigate to those sections of your code.

CodeLens in VusalStudio image
CodeLens
CodeLens without TFS integration shows you the number of times a bit of code is referenced.
While not shown here, CodeLens also has some nice Team Foundation Server (TFS) integration. If you’re using TFS, it will allow you to see commit history and unit tests targeting the code in question.