Indentation is one of the most important aspects of formatting style — properly indented code will be readable even if other formatting is inconsistent. JetBrains Rider helps you configure and maintain proper indentation in many ways.
Sources of indentation settings
You can configure indentation style on thepage of JetBrains Rider settings Control+Alt+S.
If there are EditorConfig files that affect the current file, the
indent_style properties will override JetBrains Rider indentation settings, with Clang-Format styles having higher priority than EditorConfig styles. If you want JetBrains Rider to ignore EditorConfig styles , clear the corresponding checkbox on the page of JetBrains Rider settings .
To manually increase or decrease indentation of the current line or selected code block, press Tab / Shift+Tab.
To fix indentation of the current line or for all lines in a selected code block (you can press Control+W multiple times to select a logical block) without applying other formatting preferences, press Control+Alt+I or choosefrom the menu, or alternatively press Alt+Enter and choose .
When you reformat a part of code in a file or when code is auto-formatted on editing or pasting, JetBrains Rider can calculate and apply indentation based on the existing indents in the rest of that file. You can enable or disable automatic detecting of indents with the Detect and use existing file indents for editing checkbox on the page of JetBrains Rider settings Control+Alt+S.
You can also toggle the auto-detecting indents preference and view its status in the Code Style Configuration dialog.