2

I like the idea of CodeLens, VSCode's plugin that tells you reference counts on all your functions & variables. However, when I'm scanning code, the extra vertical margin added to include the "X references" line annoys me enough that I've disabled it. This is a shame, because it's useful information.

I'd like to be able to control whether CodeLens is active via keyboard shortcut. There seem to be no "editor.action.toggleCodeLens" in the keybindings, though, and trying

{ "key": "ctrl+l", "command": "editor.codeLens = false" }

or

{ "key": "ctrl+l", "command": "editor.codeLens = !editor.codeLens" }

produces the error command 'editor.codeLens = false' not found. Is there a way to do this?

starball
  • 20,030
  • 7
  • 43
  • 238
Ben Walker
  • 908
  • 2
  • 8
  • 16
  • Possible duplicate of [Code Lens Toggle Shortcut?](http://stackoverflow.com/questions/18466475/code-lens-toggle-shortcut) – Shaun Luttin Nov 10 '16 at 05:04
  • I created an extension called [Setting Toggle](https://marketplace.visualstudio.com/items?itemName=Ho-Wan.setting-toggle) which lets me turn the codeLens on and off easily. My extension also lets you toggle up to 3 VS Code settings. You can then assign the "Setting Toggle" command to a keybinding by opening "Keyboard shortcuts". –  Jun 15 '18 at 17:18

1 Answers1

3

Try this extensions: https://marketplace.visualstudio.com/items?itemName=rebornix.toggle

It allows you to setup custom keybindings to toggle any VSCode setting

Matt Bierner
  • 58,117
  • 21
  • 175
  • 206