ReSharper Web Help

When you see a piece of code that is highlighted as error, warning, suggestion, or hint it means that the ReSharper's Code Analysis is enabled. In most cases, these code issues can be repaired or improved instantly using quick-fixes.

Quick-fixes are represented by a red or yellow light bulb icon that appears automatically to the left of a highlighted code line, when you position the caret on the highlight:

  • Yellow light bulb represents a quick-fix for code issues with warning, suggestion or hint severity
  • Red light bulb represents a quick-fix for for code issues with error severity

 Note

Some quick-fixes act as shortcuts to ReSharper code generation features. They are identified with the following icon: . Also, there are quick-fixes associated with refactorings they are identified with the following icon: .

You can display the list of available quick-fixes for a given highlight, either by clicking the light bulb or by pressing Alt+Enter. Then simply select an appropriate quick-fix from the list, and it will correct your code automatically.

To view and apply quick-fixes
  1. Click a highlight (error, warning, suggestion, or hint) in the source code, or the corresponding marker in the Marker Bar to show the light bulb.
  2. Click the red or yellow bulb, or press Alt+Enter.
  3. Select the desired quick-fix in the drop-down list of available actions, or select the action using arrow keys and press Enter.
  4. In some cases a quick-fix is applied and the code is updated immediately. If a quick-fix involves direct editing of source code (for example, Change All), the editor turns into special mode, which is indicated by a blue highlight in red frame, and a suggestion list is displayed:
  5. Select the desired option from the suggestion list and press Enter (to discard changes, press Esc). So doing, ReSharper detects all occurrences of the symbol that are highlighted as errors, and replaces them automatically.

 Tip

The list of predefined quick-fixes can be extended with custom code inspections defined in the structural search and replace patterns. For more information, see Structural Search and Replace.

See Examples of Quick-Fixes for more practical examples of quick-fixes.

For guidelines on how to change inspection severity for issues that specific quick-fixes are designed to fix, see Configuring Warnings.

See Also

Procedures

Reference