简体   繁体   中英

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?

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}")

Interesting. Codelens already has some keybindings associated with it. If you press down ALT, it shows numbers over the indicators (references, source control, test), but as far as I know there isn't one to turn on/off the indicators. I'll take this feedback and file a bug for the team that owns the codelens UI at Microsoft.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM