ReSharper Web Help

ReSharper lets you define naming rules for different symbols including but not limited to types, namespaces, interfaces, parameters, method properties and events, static fields, instance fields etc.

When you have a naming rule in force, ReSharper:

  • Keeps your specific naming guidelines in mind when it provides code completion options, generates new members, and expands templates.
  • Displays warnings when it detects members that don't comply with your naming style (in C# code):

    Coding_Assistance__Naming_Style__quick-fix

For every kind of symbol, you can configure casing options, prefixes and suffixes, variations for different access rights, abbreviations to preserve, and other options.

Regarding language coverage, you can configure:

With the procedures below you will learn how to configure ReSharper to match your naming style.

To configure a naming style for predefined entities
  1. On the main menu, choose ReSharper | Options.
  2. The Options dialog box opens. Click C#, then click C# Naming Style on the left pane of the dialog.

    Tip

    You can start configuring naming rules right from the text editor where ReSharper detects an incorrectly named symbol. When ReSharper displays a warning or suggestion to rename a symbol, press Alt+Enter and choose Change settings for rule... from the list of quick-fixes. When the Edit Rule Settings dialog box for the corresponding entity opens, proceed with step 4.
  3. On the Naming Style pane, select one of predefined entities.
  4. Click Edit Coding_Assistance__Naming_Style__options__Edit_button. The Edit Rule Settings dialog box opens.

    Coding_Assistance__Naming_Style__Options__Edit_Rule_Settings

  5. Configure name prefix, name suffix and naming style for the rule selected in the list at the top of the dialog box.
  6. Optionally, create additional rules for the selected code entity by clicking Add Coding_Assistance__Naming_Style__Options__Add_button and configuring prefix, suffix and naming style for the new rule.

    Note

    When there are several rules for a single entity, one of them acts as the default rule (highlighted with bold). ReSharper doesn't display naming suggestions if a symbol matches at least one of configured rules. However, if a symbol doesn't match any rules, ReSharper suggests renaming it in accordance with the default rule.
  7. Optionally, reorder the sequence of rules by clicking Move Up Coding_Assistance__Naming_Style__Options__Move_Up or Move Down Coding_Assistance__Naming_Style__Options__Move_Down.
  8. Optionally, remove unnecessary rule by clicking Remove Coding_Assistance__Naming_Style__Options__Remove.
  9. Clear the Enable inspections check box to prevent ReSharper from inspecting the selected code entity for naming style compliance. This setting applies to all naming rules for the current entity.
  10. Click OK to close the Edit Rule Settings dialog box.
  11. Click Save or Save To to close the Options dialog box and apply changes.
To create a user-defined naming rule
  1. On the main menu, choose ReSharper | Options.
  2. The Options dialog box opens. Click C#, then click C# Naming Style on the left pane of the dialog.
  3. On the Naming Style pane, click Advanced settings. The Advanced Naming Settings dialog box opens.

    Coding_Assistance__Naming_Style__Options__Advanced_Settings

  4. Click Add Coding_Assistance__Naming_Style__Options__Add_button to create a custom naming rule. The Edit Extended Naming Rule dialog box opens.

    Coding_Assistance__Naming_Style__Options__Edit_Extended_Naming_Rule

  5. In the Rule Description text box, specify a name for a new extended rule.
  6. In the Affected entities area, select code entities that the extended rule should cover.
  7. Use Access rights and Static/non-static areas to further constrain the scope of the extended rule.
  8. Under Naming style, configure one or more rules according to steps 4-6 of the procedure above (To configure a naming style for predefined entities).
  9. Click OK to close the Edit Extended Naming Rule dialog box.
  10. Click Save or Save To to close the Options dialog box and apply changes.
To create a list of abbreviations
  1. On the main menu, choose ReSharper | Options.
  2. The Options dialog box opens. Click C#, then click C# Naming Style on the left pane of the dialog.
  3. On the Naming Style pane, click Advanced settings. The Advanced Naming Settings dialog box opens.

    Coding_Assistance__Naming_Style__Options__Advanced_Settings

  4. Add abbreviations that ReSharper should not warn you about in the Abbreviations as plain text (UPPER CASE only) text area. Use returns, commas, semicolons or spaces as delimiters.
  5. Click OK to close the Advanced Naming Settings dialog box.
  6. Click Save or Save To to close the Options dialog box and apply changes.

You can also add abbreviations to the list from the text editor. When ReSharper detects a symbol name that contains an abbreviation which is not in the list, click Alt+Enter and select Add [abbreviation] to the abbreviations list.

Coding_Assistance__Naming_Style__add_to_abbreviations


This feature is supported in the following languages/technologies:

C# VB.NET HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts
feature_available feature_available feature_available feature_available feature_available feature_available

Tip

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.