*Your mileage may vary…
Visual Studio: an IDE I tolerate
For the past 6 years of my career, I’ve used Visual Studio as my main IDE for work. I’ve seen many iterations of it come and go over that time. As a result, I’ve gotten fairly comfortable with its quirks and would consider my usage fairly efficient.
I am sharing some of the keyboard shortcuts I use most often with you hoping it will save a few extra keystrokes and clicks in your daily work.
1. Attach to process (CTRL + ALT + P)
Fewer things are more informative when coding than attaching a debugger and stepping through the functionality to understand how the code you have written is behaving.
This shortcut opens the window that allows you to select what process you want to attach the Visual Studio debugger to.
2. Comment line (CTRL + K, CTRL + C)
This is a handy one that doesn’t need a lot of explanation. It quickly comments the line your cursor is on. Or if you have multiple lines selected it will comment all of them.
You can of course also uncomment a line that you have commented, using the following shortcut: CTRL + K, CTRL + U.
3. Toggle breakpoint (F9)
This shortcut is very useful in conjunction with the first one for your debugging sessions. Easily set or remove a breakpoint on the line your cursor is on. I for sure hate fiddling with the mouse trying to click exactly on the margin that the breakpoints live. This one saves me more time than you’d expect.
4. Extract method (CTRL + R, CTRL + M)
I use this shortcut a little bit less than the others, but I had to include it in this list as I just find it so handy. Over the years I have grown fonder of refactoring techniques. Applying the Single Responsibility Principle, whenever I feel that a method has grown too large and is handling more than one responsibility I will highlight a code section that I deem to be its own method and use this shortcut to extract it.
5. Remove and sort using (CTRL + R, CTRL + G)
This shortcut will save you from some of those annoying nit comments on your pull requests. Easily remove any unused using statements and sort them alphabetically using this shortcut.
Bonus tip for learning keyboard shortcuts of any kind
Whenever I want to quickly learn keyboard shortcuts for any program I use, I like to print a cheatsheet out and place it on my desk directly in front of my keyboard.
I also like to place the printout inside a punched pocket to keep it from getting damaged over time (most likely with coffee stains).
The cheat sheet I use for Visual Studio keyboard shortcuts can be found here.