ReSharper 5.0 Preview: Solution-Wide Warnings and Suggestions

January 27th, 2010 by Jura Gorohovsky

Over the years, ReSharper has gradually advanced from plainly highlighting errors and problems in individual code files to somehow summing up errors and problems in a larger scope, up to the entire solution.

Back in 2007, ReSharper 3.1 was the first product version to introduce Solution-Wide Error Analysis to gather data on all errors in the solution using a single tool window. ReSharper 4.5 split many code inspections to execute in private and public scope, with the latter only available when you turned on Solution-Wide Error Analysis.

Taking another huge step towards instantly seeing every problem anywhere in your solution, ReSharper 5 introduces a new code analysis feature called Solution-Wide Warnings and Suggestions. As you’ve probably guessed, it lists all warnings and suggestions that ReSharper displays in the scope of your whole solution or in a narrower scope, depending on how you call it. In other words, any code smells or other problems that you may have in your solution can now be summarized in a single tool window, making tool-based code review much easier.

When you switch on Solution-Wide Errors Analysis, Solution-Wide Warnings and Suggestions starts showing errors as well, plus warnings and suggestions that work in non-private scope.

That doesn’t mean Errors in Solution tool window becomes obsolete with R# 5: when your goal is as simple as to make your code compile, Errors in Solution quickly indicates that something in the solution went awfully wrong and you should fix things up before you can compile.

However, as soon as you’re ambitious enough to make your code green - that is, eliminate compiler warnings, implement best practices, or upgrade your code to leverage the latest language opportunities - Solution-Wide Warnings and Suggestions is exactly what you need to get the job done quickly.

The feature includes two items:

  • Inspect Code - a new command that is available by right-clicking any node in Solution Explorer, from a single file to the whole solution:
  • Inspection Results - a tool window that actually shows problems found in a certain scope, broken up into several categories:

The Inspection Results tool window is pretty much similar to other ReSharper tool windows like Type Hierarchy or Find Results: it provides common navigation, grouping and export options. It also has a code preview pane where you can instantly see the context of a problem without opening the corresponding file in the text editor:

The tool window is not updated automatically, so as soon as you’ve made substantial changes, make sure to click the Refresh button to see up-to-date inspection results:

In many scenarios, chances are you don’t want to review all code problems you may have in a scope - you’d rather focus on a particular subset. Inspection Results lets you do this by clicking the glaring Filter button:

This displays the Filter Issues dialog box where you can select or unselect individual inspections or even entire inspection groups. For example, here’s how you can discover code that can be transformed to leverage C# 3.0 and C# 4.0 language features:

When you double-click an item in Inspection Results, the corresponding file opens in the text editor in the right position for you to actually take measures: apply a quick-fix, refactor or clean up code, or whatever:

However, instead of double-clicking through all inspections, in many cases you can apply fixes right from Inspection Results: say, you’re inspecting a single file that has three inspection items:

Of the three inspection items, two can be safely fixed using Code Cleanup, which can both delete a redundant “using” directive and make an explicitly typed variable implicitly typed. Then, you press Ctrl+Alt+F right on one of these two inspection items, and the Code Cleanup dialog box displays:

You launch Code Cleanup with Full Cleanup profile, and ReSharper applies fixes for both inspections straight away! Upon refreshing Inspection Results, you only have one inspection left:

In addition to cleaning up code, you can also apply refactorings and navigation actions right from Inspection Results. I hope to cover scenarios involving this approach in subsequent posts about ReSharper 5.

To try out Solution-Wide Warnings and Inspections in its latest incarnation, make sure to download a fresh ReSharper 5 nightly build!

ReSharper 5.0 Beta Comes Out

December 24th, 2009 by Jura Gorohovsky

Download ReSharper 5.0 Beta while it’s hot!

ReSharper 5.0 introduces a great web development feature set; code analysis extended with call tracking, value tracking, and foreach-to-LINQ transformations; project-level refactorings; and a lot more enjoyable features. You can learn what’s new in greater detail at the ReSharper web site.

ReSharper 5.0 Beta integrates into both Visual Studio 2008 and Visual Studio 2010, so if you’re using Visual Studio 2010 Beta 2 and you’re missing ReSharper goodness, now is a good time to give ReSharper 5 a try.

However, keep in mind that Visual Studio 2010 Beta 2 has a number of known issues that in certain scenarios prevent ReSharper from working well. Don’t worry too much though: it doesn’t mean your Visual Studio crashes every time you press Alt+Enter! JetBrains and Microsoft engineers are aware of the problems and working together to solve them by the time Visual Studio 2010 goes RTM.

By the way, ReSharper in Visual Studio 2010 introduces a pack of special text editor integration features including a new animated error stripe and alpha-blended gray code that lets you see ReSharper highlighting even in code that ReSharper marks as unreachable:

Since this is a beta release, we desperately need your feedback. Please file any bugs that you may encounter to ReSharper issue tracker, and otherwise let us know how you feel using the new ReSharper in your Visual Studio.

Download and enjoy!

ReSharper 5.0 Preview: Loops 2 LINQ

December 11th, 2009 by Jura Gorohovsky

On the eve of ReSharper 5.0 going beta, we thought it’s just about time to start elaborating on new R# features. We’re hoping for a series of posts on improved code analysis, navigation to and within external sources, structural search & replace, ASP.NET support, and other stunning capabilities that ReSharper 5.0 provides. Today, we’ll talk about R# going crazy over LINQ.

Among many new code inspections introduced in ReSharper 5.0, two are specifically aimed at converting for and foreach loops into LINQ statements and/or combinations of extension methods and lambda expressions. Here they are:

  • Loop can be converted into LINQ-expression
  • Part of loop’s body can be converted into LINQ-expression

If you are wondering why you would ever transform traditional cozy loops to LINQ, Jimmy Bogard, Matthew Podwysocki, and Justin Etheredge have done a great job of explaining why.

Back to ReSharper work, let’s see how it converts loops to LINQ method or query syntax for you in common scenarios.

First, there’s the aggregation scenario where we loop through a collection in order to get the number of this collection’s items for which a certain condition holds true:

ReSharper highlights the foreach keyword with a green curly underline. You press Alt+Enter for available actions, and ReSharper suggests that you convert the loop to a LINQ expression:

You apply the conversion, and here we go: no more temporary counter variable. Instead, we’ve got Count extension method with a lambda-styled condition:

Next, we’re taking on the transformation scenario where we’re looping though a collection to populate another collection:

Again, ReSharper is smart enough to see that the code fragment can be converted to LINQ method syntax:

On the output side, we’ve got one line of code instead of three, thanks to the ToDictionary extension method:

For the next scenario, let’s take a collection and filter it out, so to speak, like this:

ReSharper encounters three foreach loops and readily suggests that we convert each of them. Because conversion only occurs within a selected loop and its nested loops, let’s press Alt+Enter at the top-level loop:

What we’ve got here is a pretty return statement that leverages LINQ query syntax:

All three examples above show how ReSharper converts entire loops to LINQ. In many cases, specifically with write usages inside loops, that can’t be done. For such occasions, ReSharper provides its second LINQ-related inspection: Part of loop’s body can be converted into LINQ-expression. Unlike the previous action, it’s displayed as a hint and highlighted with a straight green underline.

Let’s take another foreach loop with a complex condition and a write usage inside:

Pressing Alt+Enter at the foreach keyword highlighted as a hint lets you convert a part of the loop to LINQ syntax:

ReSharper integrates the condition with iteration variable definition, resulting in a LINQ query that makes the previously bloated write usage clear:

If, for any reason, you want to keep your loops for future generations and you don’t need LINQ-related code inspections, or, say, you want them to display as warnings or even errors, you can always configure them by choosing ReSharper | Options | Code Inspection | Severity.

The two loop 2 LINQ inspections and many more exciting features are available right now: we keep publishing fresh ReSharper 5 nightly builds that you can download and evaluate.

Welcome to ReSharper 5.0 EAP!

October 20th, 2009 by Jura Gorohovsky

We’re happy to finally provide public access to early bits of the renewed ReSharper!

Starting today, you can download nightly ReSharper builds, and the first one is already there for you.

Note that this is only pre-release software. Nightly builds are assembled automatically every night without proper alpha testing, and we can’t guarantee that they will even run on your machine. However, we hope that by participating in this Early Access Program, you can help us gradually improve product quality up to a level that is proper for final release.

Some additional notes on this EAP:

  • At this time, we’re only publishing ReSharper builds for VS 2008. We’ll start publishing VS 2010-compatible builds as soon as we verify that ReSharper works decently with VS 2010 Beta 2.
  • The UI for many new and improved ReSharper features is not yet finalized. Shortcuts and titles may change as well.

Once you have downloaded, installed, and used a nightly build for a while, please vote for it in the nightly builds page so that other users are able to judge on its quality. If you’re willing to report a bug or feature request, please do so using our bug tracker (here’s how it works).

To further comment on the quality of individual nightly builds please use jetbrains.resharper.eap newsgroup or its web mirror in our development community.

To get an idea of improvements and new features that we’re starting to reveal during this EAP, take a look at the recently published ReSharper 5 Overview.

Happy early accessing!

ReSharper 5.0 Overview

October 12th, 2009 by Jura Gorohovsky

As promised, we’re publishing a general ReSharper 5.0 overview, elaborating on its feature set.

Please keep in mind that this is a preliminary document. The general picture will stay unchanged, but local amendments cannot be ruled out at this point, and many user interface items will probably change.

Features

  • External Sources
    A solution is not limited to sources included in your projects, but also contains sources that were used to build your libraries. Some companies publish parts of their sources using the Source Server feature of debug information files (PDB). This is the same technology that Microsoft uses to provide access to source code for parts of the .NET Framework. With ReSharper 5, you can now access it as if it were a part of your solution. When no sources are available, ReSharper does a decent job of reconstructing types’ structure from metadata for your browsing pleasure.
  • Structured Patterns
    “I was assigned to a new project, and the source code is full of [your favorite code smell here]. Please, make ReSharper analyze and fix it!”. Fortunately, ReSharper 5 can address this demand. You can set up your own code patterns, search for them, replace them, include them in code analysis, and even use quick-fixes to replace! Building patterns and enforcing good practices has never been this easy. Corporate and team policies, your own frameworks, favorite open source libraries and tools — you can cover them all.

  • Project Refactorings and Dependencies View
    Once you’ve gotten used to smart, automated refactorings that ReSharper provides, you can’t think of doing them manually anymore. In this release, we extend ReSharper’s coverage to bring you several refactorings for project structure. With ReSharper 5, you can move files and folders between projects; synchronize namespaces to folder structure in any scope - as large as your solution; safely delete obsolete subsystems without going type by type; and split a file with lots of types created from usages into their own dedicated files - in one go. We have also added a special project dependencies view to help you track down excessive dependencies between projects and eliminate them. As an early ReSharper 5 user said, “I’m no longer afraid of restructuring my project. I just go and do it whenever I feel it’s right”.
  • Call Tracking
    Find usages, find usages, find usages. Formerly, attempting to track call sequences in code could end up with lost context, lots of Find Results windows and, ultimately, frustration. With ReSharper 5, you can inspect an entire call sequence in a single window, in a simple and straightforward manner. Stuck in unfamiliar code? ReSharper’s code inspecting tools for the rescue!
  • Value Tracking
    Value Tracking gives you important information about data flow in your program. At any point in your source code, select a variable, parameter, field or property and ask ReSharper to inspect it. You will then see how its value flows through your program, back to its sources or straight to consumers. Wonder how null could be passed to a specific parameter? Track it!
  • Internationalization
    Software localization and globalization has always been a tough and at times unwanted task for developers. ReSharper 5 greatly simplifies working with resources by providing a full stack of features for ResX files and resource usages in C# and VB.NET code, as well as in ASP.NET and XAML markup. Move string to resource, Find usages of resource and other navigation features, refactoring support, inspections and fixes — all ReSharper goodness for your localization pleasure.

Technologies and Languages

  • Visual Studio 2010
    We will publish more information about Visual Studio 2010 support when VS Beta 2 is released. Currently, ReSharper 5 builds support Visual Studio 2005 and Visual Studio 2008.
  • C# 4 and VB10
    New language versions nowadays appear at a great speed, and ReSharper team works hard to support them right when you need them. ReSharper 5 provides beta support for C# 4 and VB10, as Visual Studio 2010 does itself. Variance, dynamic types, named arguments and optional parameters, embedded COM assemblies — all of these features are supported in the new ReSharper. During VS 2010 Beta 2 phase we’re hoping to learn from your experience of using these features and improve their support for the Visual Studio 2010 release.
  • ASP.NET
    With this new version, ReSharper support for ASP.NET is improved tenfold. In addition to performance and responsiveness improvements, lots of new features for ASP.NET markup files are introduced to make your life easier. Web-specific navigation, master page support, new inspections and syntax highlighting for web files, File Structure and Go to File Member for in-page navigation and overview, live templates for common markup and more!
  • ASP.NET MVC
    ASP.NET MVC deserved our special attention: special syntax highlighting, inspections, navigation to and from action or controller, and even actions to create new types and methods from usage in pages.

Productivity

  • IntelliSense
    ReSharper continues to bring first-rate IntelliSense experience, and the new version gives even more. We have added automatic completion for enum members and boolean values, made automatic triggering smarter, and greatly improved performance. Completion for unresolved symbols in local scope is a new ReSharper IntelliSense feature. Another improvement is completion for all-lower text with CamelHumps  — to make cocopro match CodeCompletionProvider — and that means you don’t need to press Shift too often.
  • Bookmarks
    This is a simple yet powerful feature: drop a numbered marker with a single shortcut, jump back at any time with another keyboard key. Up to 10 numbered bookmarks, unlimited unnumbered bookmarks, full list of bookmarked positions in a single pop-up window — all to help you instantly switch between several code spots.

Inspections

  • Solution-Wide Warnings and Suggestions
    We have received a lot of positive feedback from our users regarding solution-wide error analysis, which allows you to immediately see compilation errors in the whole solution. In ReSharper 5, we took this technology to a new level by adding warnings and suggestions to the list. Now you can browse code smells that ReSharper finds across your solution and quickly improve the quality of your code.
  • Upgrade-to-LINQ Actions
    With C# 3.0 and LINQ, developers are able to write data-intensive code more easily by directly describing their intent to the compiler. However, years of imperative programming left us with tons of foreach-style code waiting to be upgraded. ReSharper 5 detects parts of your code that can be rewritten using the new LINQ syntax and offers to perform the conversion automatically, to make the developer’s intent crystal clear.
  • Use IEnumerable Where Possible
    With the power of LINQ, IEnumerable is more than enough to pass a collection of values. So why restrict yourself with an API requiring you to pass old-school arrays, Lists and ArrayLists? ReSharper will scan your code base to detect methods that can safely return and accept IEnumerable instead of a more specific type. Of course, we will also take care of the conversion.
  • New and Improved Code Inspections
    We have collected rich customer feedback and went through a list of common errors that developers make in code. Based on that, we have added a ton of highly intelligent inspections to immediately boost your .NET expertise. For example, if you take your API seriously and want it to be well documented, ReSharper will help you by highlighting errors in XML comments.

Other improvements

  • Native NUnit Support
    ReSharper 5 introduces a completely new approach to running your NUnit tests. Our engine is now based on native NUnit code. What it means to you is 100% compatibility with the latest released version of NUnit and full support of its recent unit testing features.
  • XML Formatting
    XML data is an important part of modern applications and you want it to be in order. The new version of ReSharper is supplied with a superb configurable formatter for XML files.

ReSharper 5.0: Intro

October 9th, 2009 by Jura Gorohovsky

Did you miss us?!

We’ve got some good news for you .NET junkies!

ReSharper 5.0 is getting ready for some publicity. We’ve already started providing internal 5.0 builds to our beloved JetBrains Academy experts for some initial feedback. Next step: make builds mature enough to open public EAP, and we’re looking to get that far before end of month.

You can also expect us to post a public R# 5.0 Roadmap shortly. Meanwhile, here are the four major areas that ReSharper 5.0 focuses on:

  1. Web Development. Web developers have long been asking for top-class support, so we’re starting to deliver on the promise with a pack of features for HTML, ASP.NET, and ASP.NET MVC.
  2. Project and Team. This is a valuable addition for developers having to explore much unfamiliar code and/or perform batch modifications in large-scale projects. With access to and navigation within external sources, structured patterns for searching and customizing code, and location/namespace synchronization tools working in batch mode, you can handle your colossal solutions easier.
  3. Code Analysis. In addition to fresh code inspections, ReSharper 5.0 presents multiple functional style “enumeration to LINQ” transformations, accepts warnings and suggestions into the “Errors in Solution” tool window, and introduces two major features to track what’s going on with your calls and data throughout application execution.
  4. Visual Studio 2010 and Tools. We’re on the run to support Visual Studio 2010 earlier than ever. More info on that when VS2010 Beta2 comes out. Of course, Visual Studio 2008 is supported as well.

Last but not least, we have prepared a number of introductory, feature-specific blog posts for you to feel the flavor of the new version. Stay tuned!

Issue Tracker Used by dotTrace, JetBrains YouTrack, Goes Beta

September 2nd, 2009 by Jura Gorohovsky

If you have recently reported bugs to the dotTrace team, you should have noticed that it’s done with a new issue tracker developed by JetBrains, YouTrack (previously code-named Charisma).

Today is a serious milestone for YouTrack as it goes beta.

You can read more about YouTrack features in its own section at the JetBrains web site, watch demos, and download the beta version.

In addition, YouTrack has its own blog where you can get latest updates on the development process.

You can report bugs and request new features at YouTrack’s own instance.

YouTrack 1.0 public release is scheduled by the end of 2009.

Develop and track with pleasure!

ReSharper Scores with Readers and Editors at Visual Studio Magazine

August 11th, 2009 by Obfuscator

JetBrains ReSharper has earned two of the most coveted awards at the Visual Studio Magazine 2009 Readers Choice awards:
Visual Studio Magazine 2009 Readers Choice

  • Best Development Tool (Readers Choice): In one of the most hotly contested categories: Development Tools, ReSharper beat out 80 other products to claim the top honor.
  • Most Valuable Tool (Editors Choice): Readers and panelists were asked to single out the one product in the entire survey that stood out as the most valuable, effective and compelling tool for developers. JetBrains ReSharper was their choice.

“We won’t develop without [ReSharper],” wrote one voter. No .NET developer at JetBrains does, and we don’t recommend you do either!

Seriously though, we can’t thank all of you enough for your support and recognition. Feedback like this is worth triple the effort we put into product development!

Keep developing with pleasure!

- JetBrains ReSharper Team

ReSharper 4.5.1 is Available

July 23rd, 2009 by pti

We’ve just released ReSharper 4.5.1 Maintenance build, which you can download here, or read up on the Release notes first.

This maintenance release is a free upgrade to the licensed users of any 4.x version of ReSharper. To check your upgrade eligibility, please contact sales.at.jetbrains.com.

You might also like to check the new short demos at the ReSharper Overview page.

***
Keep developing with pleasure!

- JetBrains ReSharper Team

JetBrains has fun at NDC Norway

July 10th, 2009 by Obfuscator

A couple of weeks ago we attended NDC Norway. The conference was organized on a very high level and went very well. We were excited and surprised to see how popular our products are in that part of the world!

It was also nice to chat with all those who stopped by our booth. And on that note - congratulations to the following lucky winners of ReSharper + dotTrace productivity packs:

Lars Kristian Hagen
Harry Solsem
Gante Magnussa
Alf Kare Lefdal
Ronny Hansen

Your licenses should be waiting for you in your e-mail inbox!