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.
To apply fix in scope
- Set the caret to a code issue highlighted by a Rider's inspection.
- Press Alt+Enter or click on the action indicator to the left of the caret to open the action list.
- Choose a quick fix that you want to apply.
- 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.
- Select the scope for the quick-fix to apply and click on it or press Enter.
If necessary, you can undo all that was changed in these files with a single command: choose 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.
Therefore, when you choose to fix naming in a wider scope, Rider displays an additional dialog where you can select items to 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
- Add 'template' keyword
- Add 'typename' keyword
- Change smart pointer to make function
- Delete redundant specifier
- Delete redundant typename template keywords keyword
- Make member function 'const'
- Make member function 'static'
- Remove all unused #include directives in file
- Remove redundant 'else' keyword
- Remove redundant parentheses
- Remove redundant qualifier
- Remove statement
- Remove unreachable code
- Rename to ''
- Replace expression with 'false'
- Replace expression with 'nullptr'
- 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#
- 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 inconsistent qualifier (see Code Syntax Style: Optional Member Qualifiers)
- Arrange redundant qualifier (see Code Syntax Style: Optional Member Qualifiers)
- Clarify precedence with parentheses (see Code Syntax Style: Optional Parentheses)
- Convert to auto-property (see Using Auto-Properties)
- Fix built in type reference style use type keyword/CLR type name (see Code Syntax Style: Built-In Type References)
- 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 Importing Missing Namespaces)
- Import type quick popup (see Importing Missing Namespaces)
- Join null check with assignment
- Make auto-property get-only (see Making Auto-Properties Get-Only)
- Make operator 'public static'
- Make readonly Make fields readonly (see Making Fields Readonly)
- Mark nullable (see Value and Nullability Analysis)
- Move to '' namespace
- Remove '()' (see Code Syntax Style: Optional Parentheses)
- Remove argument name specification (see Code Syntax Style: Named/Positional Arguments)
- Remove as operator
- Remove attribute
- Remove cast
- Remove initializer
- Remove 'new' modifier
- Remove param type specification
- Remove 'params' array creation
- Remove 'partial' keyword
- Remove prohibited modifier(s)
- Remove property assignment
- Remove redundant argument(s) value
- Remove redundant 'ascending'
- Remove redundant base constructor invocation
- Remove redundant 'base()'
- Remove redundant braces
- Remove redundant comma
- Remove redundant comparison
- Remove redundant condition
- Remove redundant constructor
- Remove redundant delegate constructor call
- Remove redundant else
- Remove redundant 'int'
- Remove redundant 'internal' modifier (see Code Syntax Style: Modifiers)
- Remove redundant member initializer
- Remove redundant name
- Remove redundant 'new'
- Remove redundant parentheses (see Code Syntax Style: Optional Parentheses)
- Remove redundant parenthesis (see Code Syntax Style: Optional Parentheses)
- Remove redundant signature
- Remove redundant 'string.Format()' call (see Code Analysis and Helpers for String Literals)
- Remove redundant 'ToCharArray()'
- Remove redundant 'ToString' (see Code Analysis and Helpers for String Literals)
- Remove redundant type arguments
- Remove redundant type specification
- Remove redundant verbatim prefix
- Remove 'sealed' keyword
- Remove semicolon
- Remove statement
- Remove 'unchecked' expression
- Remove unnecessary whitespace
- Remove 'unsafe' modifier
- Remove unused directives in file
- Remove unused label
- Rename to ''
- Replace 'unsafe' statement with its body
- Replace with count access
- Separate statements with blank line
- Sort modifiers (see Code Syntax Style: Modifiers)
- To extension method invocation
- Toggle var - Use 'var' or explicit type depending on the code style settings.
- Unwrap from delegate creation
- Use array initializer
- Use base class qualifier
- Use 'nameof' expression
- Use nullable short form
- Use string interpolation
VB.NET
- Import type (see Importing Missing Namespaces)
- Import type quick popup (see Importing Missing Namespaces)
- Make auto-property get-only (see Making Auto-Properties Get-Only)
- Make readonly Make fields readonly (see Making Fields Readonly)
- Move to '' namespace
- Remove 'ByVal' modifier
- Remove redundant element
- Remove redundant 'imports' in file
- Remove redundant qualifier
- Remove unused label
- Rename to ''
- To implicitly typed
- Use string interpolation
- V b make readonly Make field read-only (see Making Fields Readonly)
XAML
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
- Optimize register directives
- Remove redundant 'imports' in file
- Remove unused directives in file (see Code Syntax Style: Namespace Imports)
HTML
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