5 Tips to Increase Your Productivity With Visual Studio
5 Tips to Increase Your Productivity With Visual Studio
Do you code in Visual Studio? Then check out this great list keyboard shortcuts that can help cut down on development time.
Join the DZone community and get the full member experience.Join For Free
Discover how TDM Is Essential To Achieving Quality At Speed For Agile, DevOps, And Continuous Delivery. Brought to you in partnership with CA Technologies.
In this article, we will cover five tips that will make you more productive and make your developer life easier.
Visual Studio is a powerful and extensible IDE that can speed up your coding, give you some shortcuts, and help you be more productive in your work.
In this article, we will be working with a simple C# class. You will learn some cool features and get to experience, first-hand, the magnificence of this development environment.
1. VS Quick Launch (Ctrl + Q)
If remembering options and command placements in the menu is not your forte, Visual Studio is the tool you need.
Visual Studio is a powerful development environment with a rich menu full of commands, windows, analyzing tools, and debugging options. It can be very hard to remember all the command placements in the menu. Here is where VS Quick Launch comes in.
VS Quick launch has been around since the 2012 version of Visual Studio. Despite VS’s evolution, only the UI and placement of this tool has changed, the main functionality is still the same: launching some command or functionality by typing some keyword in the search area.
You can launch this tool with Ctrl + Q if you are in VS 2015 and on; in earlier versions you will find the search box in the top right corner of your VS window.
Try to activate an option, create a new file, or toggle the bookmarks window.
The command will be executed after pressing Enter or a mouse click.
2. VS Navigation
Here we go, the second tip is about using Visual Studio to navigate efficiently through your code in the context of large-scale projects. Indeed, working with many team members can result in hundreds of lines of code. Efficient navigation becomes vital in this context in order to improve productivity and Visual Studio is here to assist.
In practice, two types of navigation can be identified: navigation in the whole project or solution and navigation between classes.
A. Navigate To (Ctrl + , )
The VS Navigate To tool is similar to the quick launch box but instead searching in the menu we are searching in the opened solution or project.
The shortcut is "Ctrl + ," then type the name of the file. A list of propositions will appear. Then, select your file and hit Enter. The selected file will be displayed in the workspace.
B. Navigation Between Classes and Calls (F12, Ctrl + F12, Alt + F12)
For the navigation between classes and calls, we have two choices: Go to Definition and Peek definition.
Go to Definition will open the file that contains the class or call.
We can use it by :
- Selecting the call or class and pressing F12.
- Right-clicking on the class and choose Go to Definition.
The second type is Peek to Definition. This option will display the definition of your call on the same opened window.
We can use it by:
Selecting the call or class and hitting Alt + F12.
Holding Ctrl and clicking on the needed call or class.
Right click on the class and choosing Peek to Definition.
3. Use a Code Snippet
If the heaven of developers had a name, it would certainly be “Code snippet.” Write a keyword and bam! VS will write the code for you and guide you to fill it properly.
How do you use this feature? It’s so simple; just type the keyword and hit Tab.
Here are some examples:
Generate a class constructor with ctor and hit tab.
Generate a class property using prop and hit tab. Then navigate between the property properties (type and name) with tab.
Generate a full class property using propfull and hit tab; then navigate between the property properties (type and name) with tab.
4. Use VS Shortcuts
Using shortcuts is one of the most important and efficient methods to being more productive and speeding up your development. You are not obliged to remember all the shortcuts, but there are some that you should know.
Most importants shortcuts :
|Ctrl-X or Shift-Delete||Cut the currently selected item to the clipboard.|
|Ctrl-C or Ctrl-Insert||Copy the currently selected item to the clipboard.|
|Ctrl-V or Shift-Insert||Pastes the item in the clipboard at the cursor.|
|Ctrl-Z or Alt-Backspace||Undo previous editing action.|
|Ctrl-Y or Ctrl-Shift-Z||Redo the previous undo action.|
|Esc||Closes a menu or dialog, cancels an operation in progress, or places focus in the current document window.|
|Ctrl-S||Saves the selected files in the current project (usually the file that is being edited).|
|Ctrl-Shift-S||Saves all documents and projects.|
|Ctrl-K, Ctrl-C||Marks the current line or selected lines of code as a comment, using the correct comment syntax for the programming language.|
|Ctrl-K, Ctrl-U||Removes the comment syntax from the current line or currently selected lines of code.|
|Ctrl-K, Ctrl-F||Applies the indenting and space formatting for the language as specified on the Formatting pane of the language in the Text Editor section of the Options dialog to the selected text.|
If you'd like to check out all the Visual Studio shortcuts, check this link.
5. Install Extensions
Visual Studio is an extendable tool that allows you to install many modules and components via the extension marketplace.
Productivity Power Tools is a powerful productivity extension that includes a lot of tools like solution explorer filters, tab coloration, code formatting, etc.
Opinions expressed by DZone contributors are their own.