19 June 2007

ReSharper 3.0 for C# Developer

While I have a few spare minutes before reviewing another document being built for web site, marketing and such, I'd like to share brief list of new features in ReSharper 3.0 that will help C# developers to be even more productive. This list is not complete and doesn't go into details about ASP.NET support or XML and XAML features. Instead, these are core C# language productivity boosters that can be used immediately in any C# project.

Go to Symbol -- navigate to any type, field, method, property or event by its name. Of course, camels are here with their humps ready to save you some typing.

Go to next or previous error -- skip warnings and suggestions and put caret immediately on the red code.

Automatic type member layout -- sort and group fields, constructors, properties, inner types, members implementing interface and other members when your reformat code. You can specify custom code layouting patterns in options dialog.

Smart Completion -- smart-complete type arguments and type parameters, infer types and suggest applicable symbols. Also, a nice little helper to give the name to unnamed exception in catch block when smart-completing in place where Exception is expected.

Advanced type choosing -- in refactorings and other places where you have to enter type name ReSharper now provides experience similar to Go to Type.

Find symbols referenced in type or method -- useful for getting big picture about what is using inside a type or method, and drill-down to details in familiar Find Usages style.

Find dependent code -- an advanced version of former Find Module Usages command, which is capable of searching code depending on specific project throughout the solution. If you need to find how particular assembly reference is used (or not used), invoke it on reference in Solution Explorer.

Filter found usages of attributes -- attributes has two distinct categories of places where they are used. One is where they are applied to an entity and the other is where they are analysed via GetCustomAttributes() methods. If you work with attributes a lot, you will find new filter in Find Usages saving you a lot of browsing time.

Highlight usages of expression -- select expression and see where the same expression is used in a method or in a file.

Improved Type Hiearchy -- member preview pane for selected type and two new view modes for deep hierarchies. One mode shows instantiatable types of the hierarchy as roots and their bases as subnodes. The other shows leaf interfaces - those that have only classes as derived types.

Moving things around -- no need to copy/paste code in order to move statement few lines below, move out of "if" statement or push into "for" loop. Much like manual member reordering, which of course still works. Can reorder enum members, though it is not always safe - know what you are doing. Reorders parameters though not changing call sites - thus not a refactoring. Works in XML to reorder nodes too.

Generating equality -- when generating Equals & GetHashCode, you can now optionally generate equality and inequality operators, implement strongly typed IEquatable interface.

Improved Stack Trace Explorer -- now highlights types, methods and source code paths, deals better with broken stacktraces, works for localized stacktraces. Also doesn't show "paste" dialog - less one key to hit.

Generate from Solution Explorer -- hit Alt-Ins while you are on the folder, file or project in solution explorer and bring instant New File From Template menu. Combine with new Locate in Solution Explorer action to find your currently open file in Solution.

Unit Test Explorer -- browse all unit tests in solution, form arbitrary set of tests, multiple sessions with different sets (with simultaneous run!), better output presentation, and the foundation for more features in future versions.

To-do Explorer -- keeps an up-to-date list of comments matching specified patterns for the whole solution, like "TODO:", "BUG:" , "To John:", "Don't forget to remove it before release!" and so on. Processes comments in C#, VB.NET, XML, XAML and ASP.NET pages (both HTML and code).

XML support -- enables almost all editor enhancement in XML files, like expand/shrink selection, highlight and navigate to matching tag, move tags, split and join, replace tags and attributes. Provides type completion and can automatically insert assembly qualification to avoid annoying typing in files like app.config.

Custom string.Format methods -- tell ReSharper about your own format-like methods and get full featured analysis, context actions and quick fixes for them.

New code inspections -- more checks for redundancy, useful suggestions and warnings. Supports #pragma directives and project settings to suppress warnings.

New quick fixes and context actions -- less manual typing, more focus on your primary task. New quick fixes provide alternative ways to fix errors, remove redundancies and deal with type parameters and constaints. New context actions give you more power for ad-hoc code transformations.

So, these are highlights. Complete list will be available short after ReSharper 3.0 is released - either on official site or here, in my blog. There are many subtle changes and nice little additions that make up the product. I don't know some of them myself! But I strongly feel that ReSharper 3.0 is another step up to the ideal development environment.

Develop with pleasure!


Nick Parker said...

Excellent, will you be providing the new keyboard shortcuts that go with 3.0 as well?

Ilya Ryzhenkov said...

Shortcut PDF maps for both IDEA/ReSharper and VS schemes will be available on product site at the time of release.