Visual Studio Shortcuts – Visual Studio Shortcuts PDF Gift Jul 20, 2019 Hence these Visual Studio Shortcuts can prove to be handy while entering, viewing and editing the code. For me, keyboard shortcuts are always at the top in my rule book to learn new software. You can navigate in Visual Studio more easily by using the shortcuts in this article. These shortcuts include keyboard and mouse shortcuts as well as text you can enter to help accomplish a task more easily. For a complete list of command shortcuts, see Default keyboard shortcuts. Use the Visual Studio debugger to quickly find and fix bugs across languages. The Visual Studio for Mac debugger lets you step inside your code by setting Breakpoints, Step Over statements, Step Into and Out of functions, and inspect the current state of the code stack through powerful visualizations.
Use the cmd + / keybinding on the selected code. These methods can be used to comment and uncomment sections of code. In C# files, additional levels of line comments can be added, which allows regions of codes to be commented and uncommented, while still preserving actual comments: Comments are also useful for documenting code. ⌘K Keyboard Shortcuts⌘S Basic Go to editing ⌘X Cut line (empty selection) ⌘C Copy line (empty selection) ⌥↓ / ⌥↑ Move line down/up ⇧⌥↓ / ⇧⌥↑ Copy line down/up ⇧⌘K Delete line ⌘Enter / ⇧⌘Enter Insert line below/above ⇧⌘ Jump to matching bracket ⌘ Indent/ ⌘ /outdent line.
Keyboard: CTRL + K, CTRL + C (comment); CTRL + K, CTRL + U (uncomment)
Menu: Edit -> Advanced -> Comment Selection; Edit -> Advanced -> Uncomment Selection Command: Edit.CommentSelection; Edit.UncommentSelection Versions: 2008,2010 Published: 4/13/2010 Code: vstipEdit0047
Download the seriously cool Tip of the Day Extension to get the daily tips delivered to your Start Page!
Sometimes it's the simple stuff we forget about. So I present to you the classic Comment and Uncomment Selection. Naturally, you have the Comment and Uncomment buttons:
And, of course, we have the Menu items:
But it's the keyboard shortcuts that really rock! These will, predictably, comment or uncomment lines of code for you. So, let's say you have some code you want commented out. Just select it:
Then press CTRL + K, CTRL + C (in this example):
Voila! It's commented out. Okay, great, but what if you don't want to use the mouse? No problem! Just hold ALT + SHIFT + [UP or DOWN ARROW] to do a vertical selection (NOTE: In VS2008 you have to go right or left one character before you can go up or down for vertical selection):
Then press CTRL + K, CTRL + U (in this example):
And there you go! Comment and Uncomment actions anytime you want!
-->
Code snippets, often referred to as code templates, are useful for efficient programming as they allow the insertion and editing of pre-written blocks of code. Using code snippets can be convenient for quickly adding common patterns, or even for learning new patterns when as the developer you are unsure of syntax. There are templates provided for C#, F#, HTML, XML, Python, and Razor.
This section explains how to create, insert, and use snippets in code.
Inserting a snippet
There are some different ways to add code snippets, some of which are described below:
![]() Creating a new template
While there are many existing templates in a variety of languages that you can use and edit, new templates can also be added by navigating to Visual Studio > Preferences > Text Editor > Code Snippets:
Press the Add or Edit buttons to create or edit snippets.
Keywords in code snippets
After a code snippet is inserted into the editor, any keywords defined are highlighted and can be edited by tabbing between them. Keywords behave like a 'variable' in the code snippet and are defined by placing a dollar-sign
$ before and after the name of the keyword.
![]()
The Edit template window is shown below, editing the built-in
prop snippet. The snippet contains two keywords – $type$ and $name$ – which can have further properties set (such as a default value and tooltip) on the right side of the window:
The following fields are used to define a snippet:
Using keywords in the editor
To use a snippet with keywords, such as the one defined above, type the shortcut and press Tab twice, and the snippet contents will be inserted at the cursor:
Press the Tab key to move between
object and MyProperty to customize the snippet for your class.
A keyword can be repeated in a snippet, such as this
for example, notice the $i$ keyword appears 3 times:
When used in the editor, the Tab key will switch between the first
i and max . If you overtype the i with a different variable name, all three instances will be updated:
Reserved keywords
There are two reserved keywords that you can use in a snippet:
The
for snippet in the previous section is an example of both these reserved keywords.
Microsoft Visual Studio Code Mac Shortcuts DownloadSee alsoComments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |