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 and it has detected a code issue. In most cases, code issues can be repaired or improved instantly using quick-fixes.
Quick-fixes are represented by action indicators that appear to the left of a code issue when you set the caret at it. The following indicators imply quick-fixes:
- - suggests a dedicated quick-fix for the detected code issue with the Error severity level.
- - suggests a dedicated quick-fix for the detected code issue with Warning, Suggestion or Hint severity level.
- - suggests an inplace refactoring that can fix the detected code issue.
- - suggests a code generation action that can fix the detected code issue.
In most cases, a quick-fix is applied immediately. However, some quick-fixes (e.g., Change All) require user interaction to chose how exactly they transform your code. In these cases, a Hot Spot Session is deployed in the editor, where you can select one of the suggested values or provide your own values in the active input positions:
To complete the hot spot session:
- If ReSharper suggests some values fot the current parameter, use Up and Down arrow keys to navigate through the list of suggested values, or just type in a desired value.
- Press Tab or Enter to accept the value and move to the input position of the next parameter. If this is the last parameter, the hot spot session completes and the caret moves to the end position defined for the session.
- Press Shift+Tab to move the input focus to the input position of the previous parameter.
- Press Esc to exit the hot spot session. In this case, all session parameters will be initialized with default values.
Some quick fixes can be applied not only in the current caret position, but in a larger scope. For more information, see Fix in Scope.
The list of predefined quick-fixes can be extended with custom code inspections defined in the structural search and replace patterns.
See Examples of Quick-Fixes for more practical examples of quick-fixes.