What if you want to comment multiple lines but leave some space before the code? Normally, Ctrl+K, Ctrl+C will leave the comments in a nice column like in the following example: public class Class1īut notice a few not-so-nice trends in that sample? For one thing, there’s the “missing” comment line with no // and the comment characters are right up against the code. Non-Keyboard Visual Studio Comment Shortcuts I’ll admit, it’s a bit easier on the eyes. It doesn’t, however, leave a space between the comment characters and your code this has been known to upset JS linters that like to see that space by default. If you’ve got the cursor on a line with no highlighting, it’ll just comment the line from the start of your code. That all depends on what you’ve selected with your cursor. The comment shortcut will also lay down comments on a single line or multiple lines. It can comment in HTML, JavaScript, SQL, C#, CSS-you name it! Now, Visual Studio knows how to comment in several languages. And to round it out, the mapping for uncommenting is Ctrl+K, Ctrl+U. I’m going to stick to defaults, but later in this post, I’ll show you how to change those. This, of course, is the default shortcut for Edit.CommentSelection, which can be mapped to whatever you’d like. The most basic shortcut for creating a comment is Ctrl+K, Ctrl+C.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |