ReSharper 2020.1 Help

Fix in Scope

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

Apply fix in scope

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

Scalable quick-fix

Apply fix in scope

  1. Set the caret to a code issue highlighted by a ReSharper's inspection.

  2. Press Alt+Enter or click 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 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 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.

Fix 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 'override' specifier to an overriding function

  • Add 'template' keyword

  • Add 'typename' keyword

  • Apply clang-tidy fix-it for ""

  • Bulk make local var const

  • Bulk make local variable declaration const

  • 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

  • Remove unused lambda capture

  • 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 #include directives in file

  • Sort member initializers by the order of initialization

  • Use 'auto'

  • Use static_cast

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.NETLanguage: C++Language: HTMLLanguage: ASP.NETLanguage: RazorLanguage: JavaScriptLanguage: TypeScriptLanguage: CSSLanguage: XMLLanguage: XAMLLanguage: ResxLanguage: Build ScriptsLanguage: ProtobufLanguage: JSON

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: 26 May 2020