ReSharper 2016.3 Help

Fix in Scope

Most of quick-fixes can fix the current issue under the caret, but some of them (e.g. Remove unused directives, Make field read-only, Remove redundant cast, etc.) can also automatically find and fix issues in a larger scope - in the current file, in the current project or in the whole solution.

In this topic:

Applying fix in scope

You can recognize such fix by a small arrow displayed next to it in the action list.

Scalable quick-fix

To apply fix in scope

  1. Set the caret to a code issue highlighted by a ReSharper's inspection.
  2. Press Alt+Enter or click on the action indicator to the left of the caret to open the action list.
  3. Choose a quick fix that you want to apply.
  4. Click on the arrow to right of the quick-fix or press the right arrow key to expand the list of available scopes. If there is no arrow to the right of a quick-fix, then this quick-fix only applies locally.
  5. Select the scope for the quick-fix to apply and click on it or press Enter.

All files where ReSharper applies fix in scope open in editor tabs. If necessary, you can undo all that was changed in these files with a single command: choose Edit | Undo in the main menu or press Ctrl+Z.

Fixing inconsistent naming in scope

The quick-fix that fixes inconsistent naming, calls the Rename refactoring to make sure that all occurrences of the symbol are renamed in your solution.

Quick-fix for naming style violation

Therefore, when you choose to fix naming in a wider scope, ReSharper displays an additional dialog where you can select items to rename:

Fix in scope: bulk rename

List of quick-fixes that can be applied in wider scope

The full list of quick-fixes that can be applied in wider scopes includes:

C++

  • Add 'override' specifier to an overriding function
  • Remove redundant qualifier
  • Replace expression with 'false'
  • Replace expression with 'nullptr'
  • Replace import directive Fix slashes in import file path

C#

VB.NET

XAML

  • Rename to ''

JavaScript

  • Add explicit 'null'
  • Add missing comma
  • Add/change quotes
  • Convert to template string
  • Fix property name
  • Json schema incompatibilities
  • Make all variables from this list block-scope
  • Move variable '' to inner block
  • Remove unexpected comma
  • Rename to ''
  • Terminate all unterminated statements in file

ASP.NET

HTML

  • Add/change quotes

TypeScript

  • Change public modifier to conform style
  • Change to ECMAScript 6 'export default'
  • Convert cast to 'as' operator
  • Convert to ECMAScript 6 import statement
  • Fix relative path style
  • Js2 ts transformation
  • Remove redundant qualifier
  • Remove redundant reference comment
  • Remove redundant type specification
  • Remove unused 'import' statement
  • Specify '' explicitly
  • Specify variable type explicitly

This feature is supported in the following languages/technologies:

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.

Last modified: 12 October 2017

See Also