Share via


A few VS IDE Tips to make your life easier

 

This is a number of my favorite VS tips, let me know what you think

Tip #1: Select Code Using Column Mode

This is one of my favorites, if you are a copy paste person like me, you will find this very useful,
Here is how is works, while selecting text in editor press the “ALT” button, when doing this you can select columns instead of entire lines. Assuming you have these 3 variables in your code

You decide that instead of naming you variables a1, b2, c3 you just want to name them a, b & c to do this: press alt, select the numbers column

And click delete

This can be very handy when you copy and paste columns.

Tip #2: Using TODO & the Task like

You can get a list of all your TODO comments using the task list, you need to start your comments with TODO and then go to View -> Other windows-> Task List. You will also see your HACK and UNDONE comments. If you want to change the comments you see you can do this by going to

Tools->Options, then under the environment folder select Task List and add your own.

Tip#3: Store Commonly Used Code in the Toolbox

If there is a part of the code that you use all the time or a comment that you keep re-writing, you can drag it and drop it in the tool box. Whenever you need to re-use this code you can get it from the tool box

 

Tip#4: Ctrl + drag and drop to copy code

Works the same as copy and paste without changing your clipboard

 Tip#5: Code Snippets

The code Snippets can save you a lot of time doing repetitive tasks. One of my favorites is the “surround with” code snippet.

Try to select a potion of your code and press “Ctrl + S, Ctrl + K”

You will get a list of options for what you want to surround you code with

If you select Region and enter the region name, this part of the code will be surrounded in a region.

- Code snippets can also be useful with loops, switches, ..

Try to type switch and press Tab twice

With switch_on still selected, enter the name of the variable you want to switch on and press enter

 

P.S. Even better: You can create your own code snippets..