CodeNewbie Community

Cover image for Codelens in Visual Studio Community Edition
Christopher C. Johnson
Christopher C. Johnson

Posted on • Originally published at thatamazingprogrammer.com on

Codelens in Visual Studio Community Edition

One of my favorite things in Visual Studio has always been CodeLens. It's this beautiful little feature that tells you what's referencing a piece of code and where it is as well as if it has any associated tests.

From what I remember it was only available for the paid tiers of Visual Studio for the longest time. A lot of developers complained that CodeLens was missing from Express, which was an even more limited edition of Visual Studio before Community became a thing.

I hadn't thought about CodeLens outside of a work environment because I just never needed it on the smaller side-projects I made at home. As I've been making larger and larger projects for myself and the community I started to miss having the ability to quickly find where some of my functions or models were being referenced or if they had test coverage.

I mentioned that to someone tonight and they told me that we've had CodeLens in the Community since 2017.

2017!

After looking around the settings, sure enough, I found that it came with CodeLens installed but turned off by default.

All you have to do to activate it is:

  • Click Tools > Options
  • Toggle open Text Editor
  • Toggle open All Languages
  • Click CodeLens
  • Click Enable CodeLens
  • Then click OK

Ta-da! šŸŽ‰

Now you have CodeLens and can start getting better insights into your project like this:

Number of references a model named Settings Model has

Number of tests a method named Set Settings has

Discussion (0)