ReSharper 2023.3 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. Place the caret to a code issue highlighted by a $p1//product-profile[@id=$p2]/@name'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

Common

  • Structural pattern replace

C++

  • Add 'template' keyword

  • Add 'typename' keyword

  • Apply clang-tidy fix for []

  • Arrange braces

  • Arrange cv-qualifiers

  • Arrange overriding function specifiers

  • Bulk make local var const

  • Bulk make local variable declaration const

  • Bulk make parameter const

  • Bulk make ptr or ref parameter const

  • Change smart pointer to make function

  • Convert to nested namespace definition

  • Convert to nested namespaces

  • Convert to regular return type

  • Convert to trailing return type

  • Delete redundant specifier

  • Delete redundant typename template keywords keyword

  • Join declaration and assignment

  • Make class final

  • Make constexpr

  • Make member function 'const'

  • Make member function 'static'

  • Pass parameter by const reference

  • Remove all unused #include directives in file

  • Remove cast

  • Remove elaborated type specifier

  • Remove redundant conditional expression

  • Remove redundant dereference

  • Remove redundant 'else' keyword

  • Remove redundant initializer

  • Remove redundant lambda parameter list

  • Remove redundant parentheses

  • Remove redundant qualifier

  • Remove redundant template arguments

  • Remove statement

  • Remove unnecessary whitespace

  • Remove unreachable code

  • Remove unused lambda capture

  • Replace expression with 'false'

  • Replace expression with 'nullptr'

  • Replace 'if' with 'if consteval'

  • Replace 'if' with 'if constexpr'

  • Replace import directive

  • Replace redundant binary operator dereference

  • Replace redundant mem access dereference

  • Replace tabs with spaces

  • Replace throw with rethrow

  • Replace with ''

  • Replace with a type alias

  • Replace with a typedef

  • Replace with prefix operator

  • Replace with structured binding

  • Simplify conditional expression

  • Sort #include directives

  • Sort member initializers by the order of initialization

  • Use ''

  • Use 'auto'

  • Use 'contains' member function

  • Use static_cast

C#

  • Add event accessor

  • Add explicit 'return'

  • Add get accessor

  • Add init accessor

  • Add missing 'RequireForUpdate<>' call

  • Add missing 'Update' call for ''

  • Add 'new' keyword

  • Add parameter type

  • Add required members initializers

  • Add set accessor

  • Argument style

    Add missing/Remove redundant argument name (see Code Syntax Style: Named/Positional Arguments)

  • Arrange attributes

    Place attributes into single section (see Code Syntax Style: Multiple Attributes)

  • Arrange braces

    Add missing braces/Remove redundant braces (see Code Syntax Style: Braces for Single Nested Statements)

  • Arrange code body

  • Arrange default value

  • Arrange inconsistent qualifier

    (see Code Syntax Style: Optional Member Qualifiers)

  • Arrange namespace body

  • Arrange null checking pattern

  • Arrange object creation

  • Arrange redundant qualifier

    (see Code Syntax Style: Optional Member Qualifiers)

  • Arrange trailing comma

  • Clarify precedence with parentheses

    (see Code Syntax Style: Optional Parentheses)

  • Combine with object creation

  • Convert to auto-property

    (see Use auto-properties)

  • Convert to 'CompareTag'

  • Convert to conditional expression

  • Convert to primary constructor

  • Convert to raw string

  • Convert to 'switch' expression

  • Convert to 'using' declaration

  • Convert with expression to object creation

  • Create default constructor

  • Create empty constructor and add member initializers

  • Create matching checked operator

  • Discard parameter

  • Dots partial classes

  • Enforce deconstructing declaration style

  • Enforce discard declaration style

  • Extract common property pattern

  • Fix built in type reference style

    use type keyword/CLR type name (see Code Syntax Style: Built-In Type References)

  • Fix nullability mismatch with default parameter value

  • Generate constructor

  • Import extension get enumerator method

  • Import extension get enumerator method popup

  • Import method

    (see Code Syntax Style: Namespace Imports)

  • Import method popup

    Import item and all other references (see Code Syntax Style: Namespace Imports)

  • Import type

    (see Import missing namespaces)

  • Import type quick popup

    (see Import missing namespaces)

  • Inline 'out' variable declaration

  • Inline temporary variable

  • Join declaration and assignment

  • Join null check with assignment

  • Make type not nullable

  • Make abstract

  • Make all uninitialized members 'required'

  • Make anonymous function static

  • Make auto-property get-only

    (see Make auto-properties get-only)

  • Make base virtual

  • Make class abstract

  • Make class non abstract

  • Make class sealed

  • Make field non-readonly

  • Make member required

  • Make must dispose resource

  • Make non abstract

  • Make non readonly

  • Make non sealed

  • Make non static

  • Make non virtual

  • Make non volatile

  • Make null checked parameters nullable

  • Make operator 'public static'

  • Make override

  • Make parameter '<unknown>'

  • Make property init-only

  • Make readonly

    Make fields readonly (see Make fields readonly)

  • Make sealed

  • Make static

  • Make static extern

  • Make virtual

  • Mark nullable

    (see Value and nullability analysis)

  • Merge 'and' pattern

  • Merge conditional expression

  • Merge into pattern

  • Merge nested property patterns

  • Move declaration inside loop condition

  • Move local function to the end of a scope

  • Move to '' namespace

  • Must be struct for dots inheritor

  • N unit make static

  • Override hidden

  • Parenthesize signature

  • Pass string interpolation

  • Prefer generic method overload

  • Put into block

  • Redirect to capturing member

  • Relocate attribute to parameter

  • Remove '()'

    (see Code Syntax Style: Optional Parentheses)

  • Remove 'abstract' keyword

  • Remove argument name specification

    (see Code Syntax Style: Named/Positional Arguments)

  • Remove 'as' operator

  • Remove async and update returns

  • Remove attribute

  • Remove 'Attribute' suffix

  • Remove cast

  • Remove 'Cast<T>' call

  • Remove 'class' keyword

  • Remove 'ConfigureAwait(true)'

  • Remove discard

  • Remove empty region

  • Remove explicit property

  • Remove global using directive

  • Remove guard clause

  • Remove initializer

  • Remove invalid statement

  • Remove modifier

  • Remove 'new' modifier

  • Remove null checks of value type

  • Remove nullable annotations without '#nullable' context

  • Remove 'override' modifier

  • Remove param type specification

  • Remove 'params' array creation

  • Remove 'partial' keyword

  • Remove prohibited modifier(s)

  • Remove property assignment

  • Remove redundant '.WithCancellation'

  • Remove redundant '?'

  • Remove redundant [CallerArgumentExpression] argument(s) value

  • Remove redundant argument(s) value

  • Remove redundant 'ascending'

  • Remove redundant attribute

  • Remove redundant base constructor invocation

  • Remove redundant 'base()'

  • Remove redundant body

  • Remove redundant braces

  • Remove redundant 'catch'

  • Remove redundant comparison

  • Remove redundant condition

  • Remove redundant constructor

  • Remove redundant 'ContainsKey'

  • Remove redundant delegate constructor call

  • Remove redundant else

  • Remove redundant 'finally' block

  • Remove redundant fixed pointer declaration

  • Remove redundant 'int'

  • Remove redundant 'internal' modifier

    (see Code Syntax Style: Modifiers)

  • Remove redundant 'is'

  • Remove redundant member initializer

  • Remove redundant name

  • Remove redundant 'new'

  • Remove redundant nullable directive

  • Remove redundant parentheses

    (see Code Syntax Style: Optional Parentheses)

  • Remove redundant parenthesis

    (see Code Syntax Style: Optional Parentheses)

  • Remove redundant range bound

  • Remove redundant section

  • Remove redundant signature

  • Remove redundant 'string.Format()' call

    (see Code analysis and helpers for string literals)

  • Remove redundant suppression

  • Remove redundant 'ToCharArray()'

  • Remove redundant 'ToString'

    (see Code analysis and helpers for string literals)

  • Remove redundant true pattern

  • Remove redundant tuple component name

  • Remove redundant type arguments

  • Remove redundant type specification

  • Remove redundant verbatim prefix

  • Remove 'scoped' keyword

  • Remove 'sealed' keyword

  • Remove semicolon

  • Remove statement

  • Remove subpattern

  • Remove 'unchecked' expression

  • Remove unnecessary whitespace

  • Remove 'unsafe' modifier

  • Remove unused directives in file

  • Remove unused label

  • Remove unused nullable directive

  • Remove unused var

  • Remove 'virtual' keyword

  • Rename all-underscore parameter

  • Rename to ''

  • Replace casts with pattern variable

  • Replace tabs with spaces

  • Replace 'unsafe' statement with its body

  • Replace with access to last element '^1'

  • Replace with constant pattern

  • Replace with count access

  • Replace with 'field' keyword

  • Replace with JetBrains.Annotations attribute

  • Replace with primary constructor parameter

  • Rethrow exception

  • Separate statements with blank line

  • Simplify linq expression use min by and max by

  • Simplify negated pattern

  • Simplify negated relational pattern

  • Simplify raw string

  • Simplify with 'GetValueOrDefault'

  • Simplify with single 'Add'

  • Simplify with single 'Remove'

  • Simplify with 'TryAdd'

  • Simplify with 'TryGetValue'

  • Sort modifiers

    (see Code Syntax Style: Modifiers)

  • Specify attribute target

  • Swap via deconstruction

  • To compound assignment

  • To computed property

  • To conditional expression

  • To extension method invocation

  • To GUID reference

  • To null-coalescing compound assignment

  • To regular string

  • To string literal

  • Unwrap from async await

  • Unwrap from delegate creation

  • Use annotation syntax

  • Use 'ArgumentNullException.ThrowIfNull'

  • Use array empty method

  • Use array initializer

  • Use async overload

  • Use 'await using'

  • Use base class qualifier

  • Use collection expression

  • Use collection initializer

  • Use compiler attributes

  • Use conditional access

  • Use 'ConfigureAwait(false)'

  • Use discard assignment

  • Use 'EventArgs.Empty'

  • Use explicit type

    - Use 'var' or explicit type depending on the code style settings.

  • Use index from end expression

  • Use 'nameof' expression

  • Use negated pattern

  • Use null check pattern

  • Use null propagation

  • Use nullable short form

  • Use null-coalescing expression

  • Use object initializer

  • Use pattern matching

  • Use positional deconstruction pattern

  • Use range indexer

  • Use span type for stack alloc

  • Use string interpolation

  • Use symbol alias

  • Use ToArray()

  • Use type annotation syntax

  • Use 'Type.EmptyTypes'

  • Use unsigned right shift operator '>>>'

  • Use UTF-8 string literal

  • Use 'var' pattern

  • Use 'with' expression

  • Wrap with constructor

  • Wrap with lambda

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

  • Discard parameter

  • Import type

    (see Import missing namespaces)

  • Import type quick popup

    (see Import missing namespaces)

  • Make abstract

  • Make auto-property get-only

    (see Make auto-properties get-only)

  • Make class sealed

  • Make non readonly

  • Make non static

  • Make non virtual

  • Make not inheritable

  • Make property init-only

  • Make readonly

    Make fields readonly (see Make fields readonly)

  • Make static

  • Move to '' namespace

  • Pass string interpolation

  • Remove 'ByVal' modifier

  • Remove redundant element

  • Remove redundant 'imports' in file

  • Remove redundant qualifier

  • Remove unused label

  • Remove unused var

  • Rename to ''

  • To implicitly typed

  • Use string interpolation

  • V b make readonly

    Make field read-only (see Make fields readonly)

XAML

  • Remove element

  • 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 in C#

Feature is available in Visual Basic

Feature is available in C++

Feature is available in HTML

Feature is available in ASP.NET

Feature is not available in Razor

Feature is available in JavaScript

Feature is available in TypeScript

Feature is not available in CSS

Feature is not available in XML

Feature is not available in XAML

Feature is not available in Resource files

Feature is not available in build script files

Feature is not available in Protobuf

Feature is not available in JSON

The instructions and examples given here address the use of the feature in C#. For more information about other languages, refer to corresponding topics in the ReSharper by language section.

Last modified: 21 March 2024