This was a quick tutorial on how you can comment out multiple lines in VS Code. Once you are done placing cursors at desired lines, you can comment them out by using Ctrl + /: Commenting multiple lines in VS CodeĪ pretty neat way to comment out lines. And you’d see multiple cursors, something like this: Hole Alt key and click on the desired lines Hold the Alt key and click anywhere inside the line you want to comment out. Need to comment out multiple lines that are not together? You can of course keep on pressing Ctrl+/ when you are on the desired lines.īut there is a neat trick pro VS Code users love to use here. Once you select the code in any of the shown ways, you just have to use Ctrl + / (Forward slash), and the selected block will be commented out: Use Ctrl+/ after selecting your code block to comment it outīut this was specific to only comment out the block of codes, but what if I tell you can comment on multiple lines placed randomly? Bonus Tip: Comment out multiple lines placed randomly in VS Code In that case, you can collapse the entire block of code by clicking on the little arrow located beside the number of lines: For huge code block, collapse the block and then select it You can also use Ctrl + shift with down and up arrow keys: Select the code block firstīut selecting the entire block of code might not be the most convenient way, especially while dealing with large projects. The first step in commenting out a block of code is to select lines with the mouse. Select the desired lines of code and then use Ctrl + / to comment them out in VS Code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |