What's New in ReSharper 6.0
ASP.NET MVC 3 Razor support
ReSharper's ASP.NET MVC feature pack is extended with support for the new Razor view engine.
ReSharper brings its full power to C# code blocks in Razor views, including code highlighting, code completion, context actions, refactorings, and navigation.
ReSharper's navigation infrastructure, including File Structure and Go to File Member, works correctly in .cshtml files.
Quick navigation between views, controllers, and actions works with Razor as efficiently as you would expect. When returning a view from a controller action, you can now take advantage of view completion.
ReSharper applies its own highlighting to CSS syntax. In addition, every color value is underlined with the respective color, and a quick-fix is available to help change it using a graphical color picker.
You can easily find usages of a CSS property or selector both within the current file and in a larger scope.
File Structure and Go to File Member have also arrived to CSS files, bringing support for lowerCamelHumps search.
ReSharper provides its own code completion in CSS files and HTML/ASP.NET markup files. It helps you complete tag names and attributes, pseudo-classes, CSS properties and values.
In addition, ReSharper 6 introduces refactorings for CSS, such as Rename and Extract Style.
ReSharper 6 brings basic HTML support to the table. First of all, you get code completion for tags, attributes and attribute values where applicable. This is especially handy for values of class and id tags where ReSharper brings up available CSS properties and existing IDs:
We have also introduced a special kind of Parameter Info showing you a quick overview of a given HTML tag or attribute. The Rename refactoring for CSS classes and IDs can be invoked right from HTML.
Finally, we have introduced a set of context actions in HTML that should be familiar to you from your ASP.NET experience:
VB.NET code analysis
Visual Basic .NET support in ReSharper lacked on-the-fly code inspections for a couple of years, but the wait is finally over: VB.NET code analysis is making its first steps in ReSharper.
Highlighting for errors and code issues right in the text editor, ticks on the marker bar, inclusion of VB.NET code issues in Find Code Issues and Errors in Solution tool windows: it's all coming in ReSharper 6!
Enhancements in XAML support
Silverlight, WPF and Windows Phone 7 developers have a reason or two to like ReSharper 6.
We have introduced quick-fixes to create properties, dependency properties, and namespace aliases from usage, improved code completion for bindings, and made ReSharper work nicely with d:DataContext and d:DesignInstance properties.
In other news, we have enabled Silverlight internationalization assistance in addition to the previously supported WPF.
Last but not least, there's no more duplicate code completion in XAML files: on pressing Ctrl+Space, you get either ReSharper or Visual Studio IntelliSense but not both.
Whenever you're working with a color, be it in CSS, C#, VB.NET or XAML, ReSharper 6 provides color highlighting for properties representing colors and code completion visualizing colors and brushes:
In addition, a quick-fix is available enabling you to pick a color from palette:
Macros for file headers
File headers that ReSharper applies on code cleanup can now contain macros defining things such as solution, project and file name; current date and time; and file creation date and time. This means you don't have to manually update the file header ahead of every cleanup.
ReSharper suggestions explained
Sometimes, it's not outright clear why ReSharper highlights code in a particular way. However, it's now easy to get an explanation why ReSharper is coming up some of its most perplexing code inspections: clicking Why is ReSharper suggesting this in the drop-down menu that you get on pressing Alt+Enter opens a wiki page clarifying a particular inspection.
Searchable code inspection severity options
Customizing inspection severity is now a lot easier, for several reasons. First of all, all code inspections can now be configured to be shown with a particular level of severity, be it an error, warning, suggestion, or hint.
Second, we have introduced several tabs in the Options dialog that help manage inspection severity for a specific language or technology.
Last but not least, you can now search for specific inspections in the list, which is an enormous time saver if you're looking to customize inspections containing a particular keyword.
Extended navigation and search
Navigation has been enhanced and extended in a multitude of ways. For example, when you're looking to jump to a file, you can narrow down the search by entering parts of a path to the file using spaces as delimiters. This is super handy when you have hundreds of similarly named files in your solution:
Go to File Member has received a new option called Include members from related files that shows members declared in files containing base and derived types:
There's a new contextual navigation feature available for types: by calling the Navigate To menu upon a type declaration or usage, you can easily get the list of extension methods for this type:
Another new contextual navigation feature is Navigate to Parameter Declaration. This is an efficient substitute for Go to Declaration when you're dealing with multi-parameter methods: it lands you on a specific parameter instead of a method name. That means, no more lost focus while scrolling to the parameter you need.
ReSharper 6 also adds a set of new filters in the Find Results window that you use to focus on specific kinds of occurrences while searching for usages. For example, if you're searching for usages of a method, use the new Show Base Method Calls filter to restrict search results to calls to its base method:
Other new filters include Unit Test Usages to focus on usages of a symbol in test fixtures, and Interface Qualifications to filter out search results to usages of an interface in explicit implementations:
With ReSharper 6, you don't need a third-party decompiler anymore! Decompile and navigate to library code as easily as you navigate to source code. The entire ReSharper navigation infrastructure, including Go to Symbol/Type/File/File Member, File Structure, navigating through inheritance hierarchy and usage search, is available for decompiled code.
You can go to decompiled sources from anywhere, including from the source code, Go to windows, or Object Browser.
Note that we have also introduced a standalone decompiler called dotPeek that is available to everyone, free of charge.
Multiple new code inspections
We have introduced tens of new on-the-fly code inspections in ReSharper 6, all of which work in C# code and the majority in VB.NET.
Prominent additions include Possible multiple enumeration of IEnumerable that is triggered when you're doing excessive work looping through an enumerable:
Another inspection that could save you an hour or two on debugging is Return value of pure method is not used. It reminds you when you're not assigning a return value of a method that doesn't have any side effects:
Find similar issues
ReSharper 6 adds another pop-up menu item that displays on pressing Alt+Enter over highlighted code. This lets you search for similar issues in the entire project, solution, or a folder. This is a much more straightforward way to focus on a specific problem than before when you had to start with searching for code issues in a scope, and proceed with carefully customizing filters.
Converting LINQ to loops
In ReSharper 5, we have introduced transformations from for and foreach loops to LINQ statements. We simply wouldn't stop there: if you prefer traditional loops over the elegant query language, ReSharper 6 will happily transform LINQ to code for you.
New String.Format context actions
We have done a few things to help you deal with format strings with less friction. For instance, when the caret is on a format item, the item is highlighted along with its corresponding object. Then, we have a pack of new context actions to include and exclude format items.
What this essentially means is that you can enter string.Format(""), and add any number of format items with Alt+Enter from there!
Import types for pasted code
Everyone copies and pastes code sometimes, right? While we can't influence what you're copying, we can help you paste it painlessly. When an alien piece of code gets pasted in, ReSharper 6 figures which import directives it needs, and lets you create all of them with a single Alt+Enter.
ReSharper 6 lets you execute some of its most popular refactorings in a new way: you edit code first, then apply a refactoring by pressing Alt+Enter. With Rename, this means you modify a symbol declaration, press Alt+Enter and select Apply Rename Refactoring to spread the change over all usages of the symbol.
We've also enabled Change Signature and Move Static Members to work this way. With the latter, you just copy a static member, paste it in a target class, and apply the move by alt-entering upon this popup:
Improvements in unit testing
ReSharper's unit test runner has received a great deal of improvements for this release. For instance, it now does provide an error message when you're running tests and your solution doesn't compile. In terms of framework support, ReSharper 6 now detects NUnit test cases both in the Unit Test Sessions window and in the unit test pop-up menu:
In other news, we have introduced a set of default shortcuts for unit testing actions, and a new action called Repeat previous run that lets you re-run the most recent set of unit tests from any position in code.