qt_aia
Last Updated: July 25, 2019
·
335
· mbillard

Easily toggle on and off large blocks of comments

While debugging, you might sometimes need to comment on and off large portions of your code. An option to do this is to select all the lines of code you need to comment and hit a shortcut too comment or uncomment all the lines (ctrl+/ in Sublime Text 2).

Another option which does not require anything to be selected is to comment your block of comments like this:

/* Start of the section to toggle on/off
... // stuff that won't be executed
/**/ // End of the section to toggle on/off

When you want to uncomment the code, just add a / at the beginning of the first line, like this:

//*
... // stuff that will now be executed
/**/

This will comment out the first line, disabling the /* comment, while the last line comments itself out.