Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 - CodeLens toggle on/off with keyboard shortcut

I would like to have a quick keyboard shortcut to turn on/off this feature. The feature is useful, but sometimes I want to look only at code and this feature distorts the code visual appearance.

I have bound EditorContextMenus.CodeLens.CodeLensOptions to a keyboard shortcut, but this is too slow because the Options menu takes too long to open. I would really like to have shortcut that toggles this feature on and off.

How can I do this? Did I miss some option in Environment->Keyboard or is there some add-on that can help?

like image 319
watbywbarif Avatar asked Jul 31 '15 12:07

watbywbarif


People also ask

How do I turn off CodeLens?

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.

What is Ctrl Shift F in Visual Studio?

Ctrl-Shift-F is used to find all the ocuurance of a string with in entire solution and display find result window as shown below. Ctrl-F is used to find a string in the current document, project and all open documents one by one.

What is Ctrl F8?

Ctrl+F8: Performs the Size command when a workbook is not maximized. Alt+F8: Displays the Macro dialog box to create, run, edit, or delete a macro. F9. F9: Calculates all worksheets in all open workbooks.


1 Answers

To automate the Options dialog, you can create the following command in Visual Commander and assign a keyboard shortcut to it:

DTE.ExecuteCommand("EditorContextMenus.CodeLens.CodeLensOptions") System.Windows.Forms.SendKeys.Send("{TAB} {ENTER}") 
like image 101
Sergey Vlasov Avatar answered Oct 17 '22 23:10

Sergey Vlasov