Action indicators - are icons that, depending on your settings, appear in the Action Bar, in the left margin and/or the body of the text editor and identify actions available in the corresponding line and cursor position. If there are several actions available in the same place, the icon corresponding to the action of the highest priority is shown.
There are two types of action indicators: fixed indicators and context-sensitive indicators.
Fixed indicators are always shown in the action bar or in the left margin depending on the Enable action bar option (configurable in the Environment | Editor | Editor Appearance page of ReSharper options). These indicators notify about the following:
- - the method is a unit test and you can run and debug it.
- - the class is a unit test class and you can run and debug containing tests.
- - the interface has implementations and you can navigate to these implementations.
- - the type is overridden elsewhere and you can navigate to these overrides.
- - the member implements an interface method and and you can navigate to it.
- - the member overrides an inherited virtual or abstract member and you can navigate to it.
- - the member hides a member with the same in the base class, without overriding it.
- - the resource is overridden for specific cultures and you can navigate to the derived definitions.
- - the resource is defined in the base culture and you can navigate to the definition in the default culture.
- - there is a bookmark at this line.
Context-sensitive indicators show up as soon as you set the caret to a specific place in the code and suggest one or more actions that may be helpful at this place. Appearance of the context-sensitive indicators depends on the Action indicator style option (configurable in the Environment | Editor | Editor Appearance page of ReSharper options). These indicators mostly suggest automatic code corrections and transformations:
- - 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.
- - suggests a context action.
- (appears when you select a code block) - a surround action and surround templates for the selection.
Priority of action indicators
Most of the time ReSharper can indicate several actions at your caret position and therefore often an indicator of a specific action hides several more actions. However, there is a priority order to showing action indicators: if there are several actions, the indicator of the highest priority action is shown.
The priorities are as follows (from high to low):
- Actions (quick-fixes, inplace refactorings, and code generation actions) that fix code issues with the Error severity level
- Actions (quick-fixes, inplace refactorings, and code generation actions) that fix code issues with other severity levels
- Unit testing actions
- Context action
- Surround actions and surround templates
- Hierarchy navigation actions
If you click on a particular action indicator or press Alt+Enter while your caret is in the corresponding position, all available actions appear in a pop-up called Action list:
You are free to choose whether to use the suggestions or not, but it often worth taking a look at what is available at the current caret position.
The most of suggested actions appear as a result of Code Analysis. Therefore, if the code analysis is disabled for the current file, ReSharper will only suggest context actions and surround actions.
If ReSharper detects one or more code issues under your caret, the Options for inspection sub-menu appears in the action list for each inspection. You can use items of this sub-menus to configure options of the corresponding inspections.