Sunday, January 10, 2010
Being a Resharper user for the past 5 years, I had to jump on opportunity to try out the publicly released beta for the new 5.0 version. I’m currently using Visual Studio 2008, but I’ll be glad to have the updated VS2010 support from Resharper once it’s released. As for the changes in this major revision, I’m excited to try out new code inspections, LINQ integration improvements, and native NUnit integration.
- Install was quick and easy. It uninstalled the version 4.5 and questioned me about killing a task that was getting in the way.
- Starting Resharper, I’m greeted with a “License to version 4.0 is not acceptable”. This is troubling in two ways:
- The license that I bought is for 4.5 C# Edition.
- Why does a beta need a license?
- For now, using “free evaluation” – this seems to do the trick.
- As expected, the AgentSmith plugin is no longer installed (duh), but an updated version is available on their site.
I’d like to be pretty thorough in acquainting myself with the enhancements, so I’ll touch on each of them from the list here.
- Structure Patterns
- Custom built code refactorings. This could be a godsend for brownfield development – enabling project-wide cleanup for stinky “code smells”. The real power is in the “Placeholder” templating – it’s much like the Live Templates but for refactoring. The image onthe right has a pattern that I made to change from
happyHour. Needless to say, this is trivial (and useless!), but I’m readily awaiting the next time I find a code smell I can’t live with.
- Project Refactoring and Dependencies View
- I’ve been waiting for the ability to mass-rename namespaces. Resharper5 : check.
- So what does “Project Refactoring” mean? Does a project have a bunch of types declared in the same files? After a few clicks, they can all moved into their own:
- Dependency View is basically “find usages by project” – which could certainly be useful for larger solutions.
- Call Tracking, Value Tracking
- Examines method, variable, field or property usage through the solution and finds where it’s being generated or called from, as well as the opposite - where it’s being used. It’s the static-analysis version of the call stack.
- I’ve never worked on a project using Internationalization, but it’s bound to happen sooner than later. Resharper 5 adds the ability to move string to resource files as well as refactoring and inspection to support multiple languages.
- Syntax highlighting! Check it out - unused namespaces inside ASP.NET markup will now appear grayed out, just as they do in source code.
- Templates for ASP.NET:
- ASP.NET MVC
- View name autocomplete from the controller, as well as navigation to and from actions.
- … and navigation to Views. Shift+Click on a view name to jump there:
- Aside: Our project has some calls to HtmlHelper.RenderPartial(“<ViewName>”) called inside of a class instantiated with an instance of HtmlHelper (it’s a Helper for HtmlHelper). Resharper can’t resolve these names… but I wouldn’t expect it to.
- IntelliSense Changes
- In addition to performance improvements, completion can now done using abbreviated names based on CamelHumps:
- Set and jump to bookmarks with quick keystrokes. Ctrl+Shift+[0-9] to set, and Ctrl+[0-9] jump back. Ctr+~ to see which bookmarks are available:
- Upgrade to LINQ
- New and Improved Code Inspections
- So, JetBrain’s says they’ve added a bunch of new code inspections – I’m counting a little over 100 C# Context Actions in 5.0, where as 4.5 had closer to 80. There appear to be some LINQ related ones in there. They’ve also called out that it can now highlight errors in XML comments (something which the AgentSmith plugin already did quite well).
- Native NUnit Support
- To be honest, I’ve been using the previous Resharper version’s NUnit support without complaint. I’m thinking that the that the improvements are “under the hood” – it works just as well now as it did before.
- XML Formatting
- Inspection and refactoring support - “Reorder attributes” and “Collapse Empty Tag”, for instance.
- External Sources
- This promises to add navigation to referenced libraries that before could only be accessed at the higher namespace-class-method level via Visual Studio’s Object Browser. I poked around a bit on JetBrain’s site looking how to configure the symbol locations, but it doesn’t seem to be documented yet. Perhaps it might need to have the symbols locations populated in VS->Options->Debugging-Symbols, but perhaps not.
- Transparently imported settings from 4.5 – horray! Appears to be able to use the 4.5.resharper shared solution settings
- Running “Find Usages” on a class is taking much longer – in previous version it was instantaneous, now it appears to be scrounging through files instead of an index (could be External sources feature?)
- Quick navigate to Type/Filename/Symbol now match partial names – no more needing to put in a “*” to match wildcards.
- In the day or two I’ve been using it, I don’t think I’ve encountered any crashes. This is a good thing – the multitude of errors being automatically reported seem to be going to good use.
- Community sharing for code-style and and structure patterns. There’s already preference and template sharing with team members via a shared settings file. The next evolution is to extend this to the cloud and create a public library to exchange ideas with all Resharper users.
For every one of the new features I’ve encountered in the past couple of days, I’m sure there are two or three that I haven’t stumbled over yet. That’s a great thing about this product – utilizing a small subset of it’s features can greatly streamline development and increase productivity. Even after years of use, I am still happily surprised to discover new facets of the tool I hadn’t noticed or investigated before.