Friday, January 15, 2021

Visual Studio Code: Disabling Code References on Windows (a.k.a. Disabling CodeLens)

When including code snippets in documentation or a PowerPoint presentation it is desirable to remove N References displayed by default in a Visual Studio Code window. The code below shows 0 References to the class Certification (line 3), 1 reference to the Name property (line 15), and 1 reference to the Description property (line 17):


The reference information is provided by CodeLens and after disabling CodeLens, the code window appears as follows:


To disable CodeLens invoke the File Menu's Preferences menu item and select Settings (File | Preferences | Settings): 

From the User page, select the Text Editor tab and scroll until the Code Lens checkbox is visible: 


Uncheck the Code Lens checkbox.

An excellent write up on CodeLens can be found at Extensions using CodeLens.

No comments :

Post a Comment