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.
In this topic:
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 files that affect the current file, the
indent_style properties will override both Visual Studio and ReSharper indentation settings.
If you want ReSharper to ignore EditorConfig 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.