24

Under Tools > Options > Environment > Keyboard is the setting Edit.ToggleLineComment

I can see that the shortcut for the selected command is set to Ctrl + / (Global)

I'd expect that when I pressed the shortcut, any selected code would be commented out, however, when pressing the shortcut nothing happens. What am I doing wrong?

Thomas Harris
  • 573
  • 4
  • 14
  • 6
    Interesting to see not many people are talking about this. I am also suffering from the same issue in VS2019 and it's pretty annoying. Remapping the thing does nothing and when I try to use the command, it tells me "The Key Combination ... is bound to command (Toggle Line Comment) which is not currently available.". – Smokesick Dec 05 '19 at 13:19
  • Still having this issue. I'm using a Mac. – pgarciacamou May 31 '21 at 20:52
  • It's related to newlines in the selected block. Didn't figure it out though. – Maor Dahan Feb 22 '22 at 08:06
  • It's nearly 2023 and it's still not working for me. – Simon-Teodor Mărăcine Nov 28 '22 at 18:50

2 Answers2

34

For the default keyboard mapping scheme, Ctrl + / is assigned to EditorContextMenus.CodeWindow.GenerateDocumentationComments. Make sure to remove this shortcut first.

Niels Evenblij
  • 341
  • 3
  • 4
9

Change mapping from default to visual studio code.

tools->options->Environment->keyboard

beside reset button, change the mapping

Ujjwal Roy
  • 500
  • 6
  • 9