# Saturday, 13 September 2008

ReSharper-Logo I was fortunate enough to attend a special event at Trifork at which the manager, Oleg Stepanov, of the Jetbrains team creating ReSharper gave a talk on ReSharper functionality. He basically demoed a bunch of R# features most of which are pretty well known to the Vertica team and myself but a couple of nuggets did present themselves and I figured if we don't know about them probably others don't as well.

Please note that all keyboard shortcuts mentioned in this post are based on the standard R# Visual Studio keyboard layout.

Smart Code Completion

On the light side I'll start with a feature I knew was in there but I never quite got why it was useful. The feature in question is smart code complete or as I like to thing about it Smart Intellisense. You find the feature in the ReSharper menu under Code > Complete Code > Smart (CTRL + ALT + SPACE). Smart Code Completion is basically smart intellisense, you could say that it puts the "intelli" in the intellisense :)

What it does is that when you activate the feature it suggests methods and properties based on the types in the local scope. So if you're in the process of assigning an int variable from somewhere it will only suggest methods based on matching return types, not just name as is the case with standard Visual Studio intellisense. Check out the screenshots below, the one to the right is standard Visual Studio intellisense (CTRL + SPACE), the left one is R# Smart Code Completion where the list is greatly reduced.

ReSharper-4x-Smart-Code-Completion-Normal-Intellisense  ReSharper-4x-Smart-Code-Completion 

Complete Statement

Probably the most useful feature that I picked up at the meeting is Complete Statement. Complete Statement is available from the R# menu under Code > Complete Code > Complate Statement (CTRL + SHIFT + ENTER).

It bascially tries to complete the current statement that you writing so if for example you're writing a method signature you and you use the feature it will complete the method signature and move the cursor to the method body enabling you to write your code in a more fluent manner. It works in a number of situations so you really want to learn the shortcut and start experimenting with it.

Complete Statement for if-statement. First step inserts the missing parenthesis and the curlies. Second step moves the cursor to the body of the if-statement.

ReSharper-4x-Statement-Completion-If-Step1  ReSharper-4x-Statement-Completion-If-Step2 ReSharper-4x-Statement-Completion-If-Step3

Complete Statement for method signature. Inserts the curlies and moves the cursor to the method body.

ReSharper-4x-Statement-Completion-Method-Step1 ReSharper-4x-Statement-Completion-Method-Step2

And for a string variable. Inserts the semi colon and moves the cursor to the next line.

ReSharper-4x-Statement-Completion-string-Step1 ReSharper-4x-Statement-Completion-string-Step2

Generate in Solution Explorer

You probably know about the Generate feature in Visual Studio which enables you to generate properties, constructors, etc.. What I didn't know about this feature is the fact that it's also availble in the Solution Explorer and basically enables you to create a class, interface, struct, or folder. Very handy indeed.

Generate is available from the R# menu Code > Generate (ALT + INS).


Camel Case Navigation

I love the code navigation features of R#. They let me find my way around a code base very simply. I've found this particularly useful in code bases I don't know very well because I usually have an idea of what another developer might choose to call something so I just go look for part of that type name. Anyway a twist on the navigation features is the fact that you can navigate via Camel Casing so if you have a type named OrderManagementService you could look for it by typing the entire thing but with Camel Casing you basically enter the upper case letters of OrderManagementService (OMS) and it will find that type for you. Very handy and my second favorite new feature of R# :)

BTW Navigate to Type is CTRL + T, Navigate to Any Symbol is CTRL + ALT + T, Navigate to File Member is ALT + <, and Navigate to File is CTRL + SHIFT+ T. Learn 'em, love 'em.

ReSharper-4x-Navigate-by-CamelCase-Standard ReSharper-4x-Smart-Code-Completion

Coming Features

Oleg also told us a little bit about what we can expect to see in R# 4.5. The main "feature" of the 4.5 release is performance tuning and bringing down the memory footprint. They're look at speeding up R# by a factor 2 and bringing down the footprint by 100 mb. Certainly very welcome. They are sneaking in new features though and one of them is to include "Find unused code" in Solution Wide Code Analysis.

Download ReSharper 4.1

Comments are closed.