ReSharper 2016.1 Help

General Formatter Style

ReSharper | Options | Code Editing | General Formatter Style

ReSharper's formatting options are configurable in a very flexible way and for each supported language separately. While this page provides a few general settings, the language-specific pages (Code Editing | [Language] | Formatting Style) allow you to fine-tune code formatting according to your coding standards and practices.

This page of ReSharper options allows you to specify general code formatting rules that apply for all languages.

The options that you configure on this page apply in the following cases:

To configure auto-formatting of new code, use the Auto-format on semicolon and Auto-format on closing brace options in the ReSharper | Options | Environment | Editor | Editor Behavior.

ItemDescription
How to indent multi-language files These options define how to indent non-primary languages in a code file. For example, JavaScript in an HTML file.
  • Indent all languages equally using settings from main language (as Visual Studio does)
    When this option is selected, ReSharper uses similar indents for all additional languages.
  • Indent each language using its own settings (as ReSharper 7 and older did). When this option is selected, ReSharper uses indents defined for each language in the corresponding settings pages: Code Editing | [Language] | Formatting Style.
How to align when tabs are used for indents These options define whether to use tabs when aligning multiple constructs. For example, in the following code snippet, the parameters that otherwise may be on the same line are aligned by the first parameter.
void foo(int firstParameter, int secondParameter) { }
The options apply only if usage of tabs (Keep tabs) is enabled in Visual Studio options (Tools | Options | Text Editor | All Languages | Tabs). Otherwise, spaces are always used for alignment.
  • Use spaces (recommended, looks aligned on any tab size)
    When this option is selected, ReSharper uses tabs for indents and spaces for alignment:
    general_formatter_style1
  • Only use tabs (inaccurate)
    When this option is selected, ReSharper uses tabs for both indents and alignment, which may not result in precise alignment:
    general_formatter_style2
  • Mix tabs and spaces for optimal fill
    When this option is selected, ReSharper uses tabs for both indents and alignment adds necessary spaces for precise alignment.
    general_formatter_style3

See Also

Concepts:

Last modified: 19 August 2016