Visual Studio Shortcuts: Comment Selection / Uncom.This might lead you to believe that Ctrl+K is the old way of doing things and we should use Ctrl+E.īut in Visual Studio Code, the comment/uncomment functions are bound to " Ctrl+K" (from Visual Studio Code Key Bindings): You'll notice that the menu items in Visual Studio all have " Ctrl+E". In addition "Ctrl+K" starts off "insert snippet" or " Surround With", so that's less for me to try to remember. I'm used to using " Ctrl+K" to start off the shortcuts (whether formatting documents or commenting/uncommenting), so that's my current habit. Currently, both keybindings work (again with the default C# settings). You may have noticed that in this and the previous article about Format Document, we have the option of using " Ctrl+K" or " Ctrl+E" to start off the command. Otherwise, we'll end up commenting out an opening or closing tag, and we'll be left with an unbalanced comment. If the delimited comments span multiple lines, then we want to make sure to include the entire delimited comment in the selection. One thing to watch out for is when using the delimited-comment notation ( /* */ ) in our code. This means that if you then uncomment the same block, you will end up with the original code (including the original single-line comments). ![]() If a line already has a single-line comment, then the comment notations will be doubled-up. Hot Keys: CTRL+K+C for Bulk Comment & CTRL+K+C for Uncomment Manually adding and removing ‘//’ is tedious especially, if you have a long piece of code you want to deactivate. CTRL+SHIFT+F5 lets you end the debugging session, rebuild it, and create a new debugging session. This means that it will work in most situations. This shortcut combines three debugging Visual Studio code commands in one. ![]() As you can see, this uses the single-line comment notation (the //).
0 Comments
Leave a Reply. |