Advanced Static Types in TypeScript

This course explores the capabilities of TypeScript’s type system and shows how to use advanced static types in practice.

Watch the Course

My 8 Favorite ReSharper Shortcuts

Out of all the Visual Studio extensions I have installed, ReSharper is my favorite, by far. It allows me to easily refactor components, run analyses on my code base, and quickly navigate through different files. With it comes a plethora of shortcuts, far more than I can remember. Still, even a small subset has increased my productivity dramatically. Here's my list of ReSharper shortcuts that I've found to be indispensable.

Show Action List

The one shortcut known by probably every ReSharper user is ALTENTER. It opens the action list presenting quick-fix and refactoring suggestions:

Show Action List

I've more or less included it here for the sake of completeness – you've likely used it plenty of times.

Rename

Another shortcut I'm using rigorously is CTRLR, R which renames the symbol under the caret. It can be used to rename namespaces, classes, structs, methods, fields, local variables, and other symbols. The suggestions for a new name are pretty good from time to time, depending on the use case:

Rename

Introduce Variable

The next candidate is CTRLR,V which introduces a new local variable and initializes it with the currently selected expression:

Introduce Variable (1/2)

And here's the code afterwards:

Introduce Variable (2/2)

This shortcut comes in handy when you want to factor out variables of a complex expression.

Introduce Field

Similar to Introduce Variable is Introduce Field, mapped to CTRLR,F, which creates a new field from the currently selected expression. ReSharper will present a dialog box that allows you to specify the modifiers for the field:

Introduce Field (1/2)

Here's the updated code:

Introduce Field (2/2)

Refactor This

Of course, there are many, many more refactoring methods in ReSharper. Since I'm not using all of them on a daily basis, I haven't memorized every single shortcut. The one shortcut I did remember, though, is CTRLSHIFTR, which is called Refactor This. It shows a list of possible refactoring for the symbol under the caret:

Refactor This

Extend Selection

If you want to select blocks of code that belong together, CTRLSHIFTW is for you. Starting from the current caret position, ReSharper will successively expand the selection in an intelligent way:

Extend Selection

No more selecting string literals or blocks of code with the mouse! The opposite action (shrinking the selection) is implemented as well, but I rarely use it.

Go To File

To quickly navigate between files in my solution, I like to use ReSharper's Go To File function. It's mapped to CTRLSHIFTT by default, but I changed it to CTRL, because I find it easier to type. Go To File will display a little text box in which you then enter parts of the file name you want to navigate to:

Go To File (prefix)

It's pretty smart about PascalCased type names, too:

Go To File (PascalCased name)

You can even specify the folder hierarchy with a space (note the blue highlights):

Go To File (hierarchy)

Great productivity enhancement!

Locate in Solution Explorer

Finally, I'm a big fan of ALTSHIFTL, which locates the opened file in the Solution Explorer:

Locate in Solution Explorer

When working on a certain file, I often find myself needing to adapt files within the same directory as well. That's when Locate in Solution Explorer comes in especially handy.

Summary

Here's the cumulative list of shortcuts I mentioned above. I've included the alias for each shortcut so you can easily find it in the Visual Studio Keyboard settings menu in case you want to change the keys it's mapped to:

Here's how I keep those settings in sync between multiple dev machines: Keep Your Visual Studio and ReSharper Settings In Sync Between Multiple Development PCs

That was just the top of the list, there's more! Other shortcuts I'm using frequently that I haven't mentioned so far include:

I recommend you go ahead and explore them on your own. If you're still hungry for more shortcuts, go ahead and explore the Keyboard Shortcuts page in the official ReSharper documentation. I'm sure you'll find plenty of goodies in there.

Learn Node