ReSharper 2024.3 Help

Tabs and Indents

ReSharper options: Code Editing | CSS | Formatting Style | Tabs and Indents

This page helps you specify how ReSharper should format indents in your code when you type or when you reformat existing code.

Indentation-settings source

By default, ReSharper uses Visual Studio preferences for tabs and indents (Tools | Options | Text Editor | All Languages | Tabs and Tools | Options | Text Editor | [language] | Tabs). However, if you prefer to share formatter preferences with your team using ReSharper's layered settings, you can clear the Use indent style and size from Visual Studio checkbox , and then configure and save your indentation preferences to the team-shared setting layer.

If there are .editorconfig files that affect your solution, preferences on this page could be overridden by EditorConfig styles. You will see a yellow warning if at least one preference on the page is overridden by EditorConfig or Clang-Format styles for the current file, each overridden preference will also be highlighted with yellow. For example:

Code formatting options overridden by EditorConfig styles

Combine indentation and alignment in multiline constructs

If your preferences say that whitespaces should be used for indents, ReSharper will also use whitespaces to align multiple constructs — for example, when function parameters on multiple lines are aligned by the first parameter:

void foo(int firstParameter, int secondParameter) { }

However, when you choose to use tabs for indents, there could be different ways for aligning multi-line constructs. ReSharper lets you choose which of these ways to use when creating new and reformatting existing code.

You can configure preferences for aligning multi-line constructs with the How to align when tabs are used for indents option .

Use spaces (recommended, looks aligned on any tab size)

When this option is selected, ReSharper uses tabs for indents and spaces for alignment:

Use spaces (recommended, looks aligned on any tab size)

This is recommended option because code aligned with second and third options may lose alignment when viewed in an editor with a different tab size.

Only use tabs (inaccurate)

When this option is selected, ReSharper uses tabs for both indents and alignment, which may not result in precise alignment:

Only use tabs (inaccurate)
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.

Mix tabs and spaces for optimal fill
Last modified: 11 February 2024