ReSharper in Detail: Hints – a New Level of Code Inspection in ReSharper 4.0

Posted on by Jura Gorohovsky

Until recently (that is, until R# 4.0 nightly builds became available), ReSharper had three levels of code analysis:

  • Errors (to highlight uncompilable code)
  • Warnings (to mark code items that don’t prevent your code from compiling but may nevertheless represent serious coding inefficiencies)
  • Suggestions (to draw your attention to things that are not necessarily wrong but useful to know)

R# 4.0 introduces a new, considerably less intrusive level of code analysis results – hints.
Unlike errors, warnings and suggestions, hints are not taken into account when you navigate to next/previous highlights, not shown in the Marker Bar and therefore do not influence the color of the Status Indicator. A hint simply brings your attention to a particular code detail and recommends a way of improvement. Code items that have associated hints are highlighted with a solid green underline. Move the mouse pointer over a highlighted item to view the corresponding hint in a tooltip:

Putting the caret at a highlighted item allows you to display the hint in the status bar.
As usual, for any code inspection item that is shown as a hint by default, you can modify inspection severity to display it as a suggestion, error or warning. You can do that in one of the two alternative ways:

  • using the general list of code inspection items in ReSharper | Options | Code Inspection | Inspection Severity, or
  • using an item-specific Inspection options dialog box (which is new in ReSharper 4.0, by the way) that you can open by Alt+Entering a specific hint and choosing Inspection options for [name of inspection item] in the drop-down list.

In practice, hints turned out to be a convenient way for ReSharper to suggest migrating to C# 3.0 features without disturbing your coding sessions too much. That’s a reason why they’re somewhat left out of ReSharper’s traditional “show code highlights and let user navigate between them” routine.

Comments below can no longer be edited.

6 Responses to ReSharper in Detail: Hints – a New Level of Code Inspection in ReSharper 4.0

  1. Libor says:

    April 3, 2008

    Hi, this looks interesting but I wonder if hints can be well seen. Hints are underlined with green color, right? So I wonder, if I can spot these hints easily when I scroll fast through my code 🙂 or if I have to look around carefully to find them

  2. Jura Gorohovsky says:

    April 3, 2008

    Hints are actually meant to be the least noticeable way of highlighting code as they’re optional by nature.
    If you’re scrolling your screen really fast, then you’re likely to overlook them.
    On top of that, if we take the “use implicitly typed local variable declaration” inspection item as an example, it is highlighted as suggestion in cases when types are explicitly specified at both sides of an assignment and is therefore more noticeable.
    Eventually, you can introduce a custom scheme of highlighting your code if you need to – the Inspection Severity tab is at your disposal.

  3. Libor says:

    April 4, 2008

    thanks for clearing this up
    btw how many hints can resharper recognise?

  4. Jura Gorohovsky says:

    April 4, 2008

    In the default configuration of my current build, six code inspection options are displayed as hints. The exact number might change, though, as we steadily move on to RTM.

  5. Giorgio says:

    April 9, 2008

    Can you give us a ballpark idea of when it will go RTM?

  6. Jura Gorohovsky says:

    April 9, 2008

    We are currently planning to go RTM in the middle of May.
    Still no promises, though.


Subscribe to .NET Tools updates