ReSharper 2018.1 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.

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:

ASP.NET

C++

  • Add missing function parameter description
  • Add 'override' specifier to an overriding function
  • Add 'template' keyword
  • Add 'typename' keyword
  • Apply clang-tidy fix-it for ""
  • Change smart pointer to make function
  • Delete redundant specifier
  • Delete redundant typename template keywords keyword
  • Join declaration and assignment
  • Make member function 'const'
  • Make member function 'static'
  • Remove all unused #include directives in file
  • Remove redundant 'else' keyword
  • Remove redundant member initializers
  • Remove redundant parentheses
  • Remove redundant qualifier
  • Remove statement
  • Remove unreachable code
  • Replace expression with 'false'
  • Replace expression with 'nullptr'
  • Replace 'if' with 'if constexpr'
  • Replace import directive Fix slashes in import file path
  • Replace throw with rethrow
  • Replace with prefix operator
  • Sort member initializers by the order of initialization

C#

HTML

  • Add/change quotes

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

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'
  • Specify '' explicitly
  • Specify variable type explicitly

VB.NET

XAML

  • Rename to ''

This feature is supported in the following languages and technologies:

Language: C# Language: VB.NET Language: C++ Language: HTML Language: ASP.NET Language: Razor Language: JavaScript Language: TypeScript Language: CSS Language: XML Language: XAML Language: Resx Language: Build Scripts Language: Protobuf Language: JSON
Feature is available Feature is available Feature is available Feature is available Feature is available Feature is not available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available

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: 20 August 2018

See Also