JetBrains Rider 2024.3 Help

Ignore parts of the code

In most solutions, there are parts of the code where you want to disable some or all of JetBrains Rider features. This topic lists all available ways to make JetBrains Rider ignore specific parts of the code.

Disable code inspection for parts of the code

Scenario

Minimize unwanted results in design-time code inspection and code inspection in specific scope by ignoring parts of code that you are not going to improve.

How to ignore

  • To ignore the current file, press Ctrl+Alt+Shift+8.

  • To ignore a part of a file, add the // ReSharper disable All comment before the ignored part and // ReSharper restore All after it.

What is disabled

All code inspection features .

Disable code inspections with lower severity levels in generated code

Scenario

Ignore generated parts of the code to minimize unwanted results in design-time code inspection and code inspection in specific scope but do not ignore errors and warnings in that parts to make sure that the generated code compiles.

How to ignore

  • List specific files and folders, file masks, or names of regions containing generated code on the Editor | Inspection Settings | Generated Code page of JetBrains Rider settings Ctrl+Alt+S.

  • If you use .editorconfig in your solution, you can also mark generated code using the generated_code property. For example:

    [*generated.cs] generated_code = true

What is disabled

Code inspections with lower severity levels as well as code cleanup.

Exclude types, members, and namespaces from import and completion suggestions

Scenario

You may want some types, members, or namespaces not to be suggested, for example, if you have something similar to a system type in your solution, say MyFramework.MyCollections.List, but you are not actually using it.

How to ignore

To exclude such items from the suggestions, add them to the Exclude from import and completion list on the Editor | General | Auto Import page of JetBrains Rider settings Ctrl+Alt+S.

The format of the entries is Fully.Qualified.Name, Fully.Qualified.Name.Prefix*, or *Fully.Qualified.Name.Suffix. Generic types are specified as List`1.

What is disabled

The specified items will not appear in import namespace suggestions and in code completion suggestions.

Last modified: 24 May 2024