Improving Visual Studio Productivity (Shortcuts).

In this post I'll talk about how to improve the productivity by using different shortcuts that are available in Visual Studio.

First, think about why you might want to do this. If your 'why' is not strong enough, you won't be able to push yourself into learning and maintaining these changes. Here are my reasons, your reasons might be different, but you need a reason. 
  1. Personally, my main goal is to be the best, to always improve, to be the champion. 
  2. I dislike doing the same things over and over again, so I'll find ways to automate repetitive tasks. 
  3. In the long run, I want to do things better, with fewer bugs and faster than people not using all the tools available. From time to time, I have to pause and review my processes and tools to help keep me on track. 

Visual Studio Shortcuts

There are many shortcuts available for use in Visual Studio for almost any command. I have setup my shortcuts similar to my favorite fast paced games (See Fast keyboard / Mouse use). I noticed that I could become a better gamer and developer by aligning my VS shortcuts to my gaming style. The main point here is to make sure your right hand doesn't leave the mouse unless you are going to type.

To get started go to "VS \ Tools \ Options \ Environment \ Keyboard", there you can type the name of the command and then can change or learn it's shortcut.  Here are some shortcuts to take note of:
  1. File.Close - My favorite, once I finish working on a class and it complies with the SOLID standard, I just close the file and move to the next class.
  2. ExtractInterface - I use the ReSharper version, but both should be good. To make a SOLID (Liskov substitution principle) class it'll need to have an interface if possible, this means that I'll be creating many interfaces every day. This tool will create the interface, methods and properties based on the current class.
  3. Refactor.Rename - For this one I also use the ReSharper version. I find that the easiest way to follow the "Single responsibility principle" of a SOLID class is to give it a name that defines it's responsibility. This means that if the class responsibility changes the class name will most likely change to reflect this. Sometimes I may give a class a general name, until I get it to work, but once it is done I'll come back to it and refactor it to make sure it is SOLID and has good name.
  4. Light Bulb - This is one of my most used shortcuts. I have it setup to open with "Alt + Enter" so that I can quickly hit both keys with both thumbs (right hand near the number pad Enter) and then hit Enter again to perform the first action in the drop down.
    Common usages:
    • Initialize field from constructor - I use this for read-only dependencies that should be inserted from the constructor. This way I almost never manually modify the constructor. 
    • Make field '{0}' readonly - dependencies should be read-only. With this action, I don't have to type "readonly", but this is only available if the dependency is already being used.
    • Rename to '{0}' - Useful to rename code that doesn't fit the standards.
    • Move to '{0}' - Every class should have its own file (Standard practice).
    • Check parameter for null - Adds safety check for parameters.  This should be done in constructors and public methods.
    • There are other options to learn about. Don't stop here.
  5. Format Document - This shortcut will vary depending on the tool you use. Right now, I'm just using a macro that runs multiple shortcuts:
    • RemoveAndSortUsings - Standard practice
    • Edit.FormatDocument - Removes extra spaces, and aligns brackets
    • AdjustNamespaces - The namespace should match the folder structure.
  6. ParamaterInfoShow - This helps me see the parameter information of methods without having to go to the method.
  7. SyncWithActiveDocument - Makes the solution explorer select and show the current open document.
  8. GoToDefinition / GoToImplementation - These shortcuts are extremely useful when researching how thing works. I use these shortcuts with the mouse: "Ctrl + Click" and "Ctrl + Alt + Click" respectively.
  9. ToggleBreakPoint - (F9) This is a faster way to create break points.
  10. Start Debugging - (F5) Don't we all love this one?
  11. Step into / Step Over - (F11 / F10) Using these shortcuts speeds up debugging.
  12. Common keyboard shortcuts - Of course I also use shortcut such as (Copy, Paste, Cut, Delete line, Undo, Redo)
Now next time you right click somewhere, click an icon, or open a menu, remember that your productivity just went down. Consider assigning a shortcut for the command you just looked up if it is common usage. 
If you use this and other common shortcuts you'll get become a better 10X developer.

Thanks for reading and please share and leave a comment below.
What did you like? What would you change?

Comments