.NET Tools
Essential productivity kit for .NET and game developers
ReSharper in Detail: Hints – a New Level of Code Inspection in ReSharper 4.0
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.