Indentation is one of the most important aspects of formatting style — properly indented code will be readable even if other formatting is inconsistent. ReSharper helps you configure and maintain proper indentation in many ways.
Sources of indentation settings
By default, ReSharper uses Visual Studio preferences for tabs and indents ( and ). 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 check box on the page of ReSharper options, and then configure and save your indentation preferences to the team-shared setting layer.
If there are EditorConfig or Clang-Format files that affect the current file, the
indent_style (for EditorConfig) or
UseTab (for Clang-Format) properties will override both Visual Studio and ReSharper indentation settings, with Clang-Format styles having higher priority than EditorConfig styles. If you want ReSharper to ignore EditorConfig or Clang-Format styles, clear the corresponding check box on the page of ReSharper options.
When you reformat a part of code in a file or when code is auto-formatted on editing or pasting, ReSharper can calculate and apply indentation based on the existing indents in that file. By default, auto-detecting indents is disabled but you can enable it on the page of ReSharper options.
You can also toggle the auto-detecting indents preference and view its status in the File Formatting Info window.
Note also, that if you enable auto-detecting indents, or indents in ReSharper settings, or if you have .editorconfig files that affect the current file, then indents from these sources are temporary saved in Visual Studio settings while the affected file is open and active in Visual Studio.
You should take this into account if synchronization of Visual Studio settings is enabled.