In my work with C# in Visual Studio Code, I found the “Reference code lens” feature to be somewhat distracting. The reference numbers that appear above methods and properties can clutter the editor, especially when working with large files. If you’re like me and prefer a cleaner, less noisy environment, you’ll want to know how to turn this feature off. Fortunately, disabling it is quick and easy, and I’ll walk you through it.
Thank me by sharing on Twitter 🙏
Why Remove the Reference Code Lens?
By default, Visual Studio Code shows a “Reference code lens” that indicates how many times a method, class, or property is referenced in the code. While useful in some scenarios, this can become distracting when you’re focusing on the logic and structure of your code rather than its references. Turning off the code lens cleans up the interface, letting you focus better on your work.

If you ever need the reference count again, it’s just a few settings clicks away.
How to Disable the Reference Code Lens in VSCode
Here’s how you can easily turn off the reference code lens for C#:
- Open the Settings
First, pressCtrl + ,
(orCmd + ,
on macOS) to open the settings panel. ![Open Settings Screenshot] - Search for “Reference code lens”
In the search bar at the top, type “Reference code lens”. This will bring up the relevant setting. ![Search for Reference Code Lens Screenshot] - Disable the Code Lens
You’ll find a checkbox labeled Reference Code Lens under the.NET
section. Simply uncheck it to disable the feature. Alternatively, if you prefer using thesettings.json
file directly, here’s what you’ll need to add or modify:
{
"dotnet.codeLens.enableReferencesCodeLens": false
}

And that’s it! With this setting turned off, your editor will no longer display reference counts, giving you a cleaner, more focused workspace.
iPhone Charger 3 Pack 10 ft Apple MFi Certified Lightning Nylon Braided Cable Fast Charging Cord Compatible with iPhone 13 12 11 Pro Max XR XS X 8 7 6 Plus SE iPad and More
$9.99 (as of June 8, 2025 18:42 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Amazon Basics Micro SDXC Memory Card with Full Size Adapter, A2, U3, Read Speed up to 100 MB/s, 128 GB, Black
$11.99 (as of June 8, 2025 18:42 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)The Coming Wave: AI, Power, and Our Future
$17.72 (as of June 8, 2025 15:49 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Conclusion
Disabling the reference code lens in VSCode is a simple tweak that can significantly reduce visual clutter when working on C#. By following the steps above, you can streamline your coding environment and bring more focus to the tasks at hand. Whenever you need the reference counts back, it’s just a quick settings change away.