C# - Tabs, Indents, Alignment
Last modified: 21 July 2022General
Indent style
Property names:
indent_style
, [resharper_]csharp_indent_style
Possible values:
tab
: Tabspace
: Spaces
Examples:
tab |
---|
|
space |
---|
|
Indent size
Property names:
indent_size
, [resharper_]csharp_indent_size
Possible values:
an integer
Examples:
value: 0 |
---|
|
value: 1 |
---|
|
value: 2 |
---|
|
Tab width
Property names:
tab_width
, [resharper_]csharp_tab_width
Possible values:
an integer
Examples:
value: 0 |
---|
|
value: 1 |
---|
|
value: 2 |
---|
|
Continuous line indent multiplier
Property names:
[resharper_]csharp_continuous_indent_multiplier
, [resharper_]continuous_indent_multiplier
Possible values:
an integer
Examples:
value: 0 |
---|
|
value: 1 |
---|
|
value: 2 |
---|
|
Nested statements
Indent nested "using" statements
Property names:
[resharper_]csharp_indent_nested_usings_stmt
, [resharper_]indent_nested_usings_stmt
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Indent nested "fixed" statements
Property names:
[resharper_]csharp_indent_nested_fixed_stmt
, [resharper_]indent_nested_fixed_stmt
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Indent nested "lock" statements
Property names:
[resharper_]csharp_indent_nested_lock_stmt
, [resharper_]indent_nested_lock_stmt
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Indent nested "for" statements
Property names:
[resharper_]csharp_indent_nested_for_stmt
, [resharper_]indent_nested_for_stmt
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Indent nested "foreach" statements
Property names:
[resharper_]csharp_indent_nested_foreach_stmt
, [resharper_]indent_nested_foreach_stmt
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Indent nested "while" statements
Property names:
[resharper_]csharp_indent_nested_while_stmt
, [resharper_]indent_nested_while_stmt
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Parenthesis
Use continuous line indent inside parenthesis
Property names:
[resharper_]csharp_use_continuous_indent_inside_parens
, [resharper_]use_continuous_indent_inside_parens
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Indent method declarations' parenthesis
Property names:
[resharper_]csharp_indent_method_decl_pars
, [resharper_]indent_method_decl_pars
Possible values:
inside
: Inside parenthesis (BSD/K&R style)outside
: Parenthesis and inside equally (Whitesmiths style)outside_and_inside
: Parenthesis 1x, inside 2x (GNU style)none
: No indent
Examples:
inside |
---|
|
outside |
---|
|
outside_and_inside |
---|
|
none |
---|
|
Indent method calls' parenthesis
Property names:
[resharper_]csharp_indent_invocation_pars
, [resharper_]indent_invocation_pars
Possible values:
inside
: Inside parenthesis (BSD/K&R style)outside
: Parenthesis and inside equally (Whitesmiths style)outside_and_inside
: Parenthesis 1x, inside 2x (GNU style)none
: No indent
Examples:
inside |
---|
|
outside |
---|
|
outside_and_inside |
---|
|
none |
---|
|
Indent statement (if, while, for, etc) parenthesis
Property names:
[resharper_]csharp_indent_statement_pars
, [resharper_]indent_statement_pars
Possible values:
inside
: Inside parenthesis (BSD/K&R style)outside
: Parenthesis and inside equally (Whitesmiths style)outside_and_inside
: Parenthesis 1x, inside 2x (GNU style)none
: No indent
Examples:
inside |
---|
|
outside |
---|
|
outside_and_inside |
---|
|
none |
---|
|
Indent type parameter's angles
Property names:
[resharper_]csharp_indent_typeparam_angles
, [resharper_]indent_typeparam_angles
Possible values:
inside
: Inside parenthesis (BSD/K&R style)outside
: Parenthesis and inside equally (Whitesmiths style)outside_and_inside
: Parenthesis 1x, inside 2x (GNU style)none
: No indent
Examples:
inside |
---|
|
outside |
---|
|
outside_and_inside |
---|
|
none |
---|
|
Indent type argument's angles
Property names:
[resharper_]csharp_indent_typearg_angles
, [resharper_]indent_typearg_angles
Possible values:
inside
: Inside parenthesis (BSD/K&R style)outside
: Parenthesis and inside equally (Whitesmiths style)outside_and_inside
: Parenthesis 1x, inside 2x (GNU style)none
: No indent
Examples:
inside |
---|
|
outside |
---|
|
outside_and_inside |
---|
|
none |
---|
|
Indent other parenthesis and brackets
Property names:
[resharper_]csharp_indent_pars
, [resharper_]indent_pars
Possible values:
inside
: Inside parenthesis (BSD/K&R style)outside
: Parenthesis and inside equally (Whitesmiths style)outside_and_inside
: Parenthesis 1x, inside 2x (GNU style)none
: No indent
Examples:
inside |
---|
|
outside |
---|
|
outside_and_inside |
---|
|
none |
---|
|
Preprocessor directives
Indent #if, #else, #elif, #endif
Property names:
[resharper_]csharp_indent_preprocessor_if
, [resharper_]indent_preprocessor_if
Possible values:
no_indent
: No indentusual_indent
: Indent as usualoutdent
: Outdentdo_not_change
: Do not change
Examples:
no_indent |
---|
|
usual_indent |
---|
|
outdent |
---|
|
do_not_change |
---|
|
Indent #region, #endregion
Property names:
[resharper_]csharp_indent_preprocessor_region
, [resharper_]indent_preprocessor_region
Possible values:
no_indent
: No indentusual_indent
: Indent as usualoutdent
: Outdentdo_not_change
: Do not change
Examples:
no_indent |
---|
|
usual_indent |
---|
|
outdent |
---|
|
do_not_change |
---|
|
Indent other preprocessor directives
Property names:
[resharper_]csharp_indent_preprocessor_other
, [resharper_]indent_preprocessor_other
Possible values:
no_indent
: No indentusual_indent
: Indent as usualoutdent
: Outdentdo_not_change
: Do not change
Examples:
no_indent |
---|
|
usual_indent |
---|
|
outdent |
---|
|
do_not_change |
---|
|
Other indents
Indent "case" from "switch"
Property names:
csharp_indent_switch_labels
, [resharper_]indent_switch_labels
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Outdent statement labels
Property names:
[resharper_]csharp_outdent_statement_labels
, [resharper_]outdent_statement_labels
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Indent type constraints
Property names:
[resharper_]csharp_indent_type_constraints
, [resharper_]indent_type_constraints
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Don't indent comments started at first column
Property names:
[resharper_]csharp_stick_comment
, [resharper_]stick_comment
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
---|---|
|
|
Before formatting | After formatting, false |
---|---|
|
|
Place comments at first column when commenting out code
Property names:
[resharper_]csharp_place_comments_at_first_column
, [resharper_]place_comments_at_first_column
Place comments at the first column when commenting out code. Otherwise, comments will use the indentation level of the commented code.
Possible values:
true | false
Use previous element's indent on partial format
Property names:
[resharper_]csharp_use_indent_from_previous_element
, [resharper_]use_indent_from_previous_element
When formatting only a part of the file, try to take the indent from elements on previous lines (previous statements/class members/etc).
If turned off, the indent will be the parent element's (usually the parent block) indent plus the indent from the indent settings.
Possible values:
true | false
Indent braces inside statement conditions
Property names:
[resharper_]csharp_indent_braces_inside_statement_conditions
, [resharper_]indent_braces_inside_statement_conditions
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Align multiline constructs
How to align when tabs are used for indents
Property names:
[resharper_]csharp_alignment_tab_fill_style
, [resharper_]alignment_tab_fill_style
Possible values:
use_spaces
: Use spaces (looks aligned on any tab size)use_tabs_only
: Only use tabs (inaccurate)optimal_fill
: Mix tabs and spaces for optimal fill
Examples:
use_spaces |
---|
|
use_tabs_only |
---|
|
optimal_fill |
---|
|
Align even if the resulting indentation is too large
Property names:
[resharper_]csharp_allow_far_alignment
, [resharper_]allow_far_alignment
Allow alignment even if construct is located too far to the right, more than 2/3 of `Hard wrap at` limit
Possible values:
true | false
Method parameters
Property names:
[resharper_]csharp_align_multiline_parameter
, [resharper_]align_multiline_parameter
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
List of base classes and interfaces
Property names:
[resharper_]csharp_align_multiline_extends_list
, [resharper_]align_multiline_extends_list
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
LINQ query
Property names:
[resharper_]csharp_align_linq_query
, [resharper_]align_linq_query
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Binary expressions
Property names:
[resharper_]csharp_align_multiline_binary_expressions_chain
, [resharper_]align_multiline_binary_expressions_chain
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Outdent binary operators
Property names:
[resharper_]csharp_outdent_binary_ops
, [resharper_]outdent_binary_ops
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Chained method calls
Property names:
[resharper_]csharp_align_multiline_calls_chain
, [resharper_]align_multiline_calls_chain
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Outdent dots in chained method calls
Property names:
[resharper_]csharp_outdent_dots
, [resharper_]outdent_dots
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Array, object and collection initializer
Property names:
[resharper_]csharp_align_multiline_array_and_object_initializer
, [resharper_]align_multiline_array_and_object_initializer
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Switch expressions
Property names:
[resharper_]csharp_align_multiline_switch_expression
, [resharper_]align_multiline_switch_expression
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Property patterns
Property names:
[resharper_]csharp_align_multiline_property_pattern
, [resharper_]align_multiline_property_pattern
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Binary patterns
Property names:
[resharper_]csharp_align_multiline_binary_patterns
, [resharper_]align_multiline_binary_patterns
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Outdent binary patterns
Property names:
[resharper_]csharp_outdent_binary_pattern_ops
, [resharper_]outdent_binary_pattern_ops
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Anonymous method body
Property names:
[resharper_]csharp_indent_anonymous_method_block
, [resharper_]indent_anonymous_method_block
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Call arguments by '('
Property names:
[resharper_]csharp_align_first_arg_by_paren
, [resharper_]align_first_arg_by_paren
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Call arguments
Property names:
[resharper_]csharp_align_multiline_argument
, [resharper_]align_multiline_argument
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Tuple components
Property names:
[resharper_]csharp_align_tuple_components
, [resharper_]align_tuple_components
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Other expressions
Property names:
[resharper_]csharp_align_multiline_expression
, [resharper_]align_multiline_expression
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Statement conditions inside parenthesis
Property names:
[resharper_]csharp_align_multiline_statement_conditions
, [resharper_]align_multiline_statement_conditions
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
"for" statement header
Property names:
[resharper_]csharp_align_multiline_for_stmt
, [resharper_]align_multiline_for_stmt
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Multiple declarations
Property names:
[resharper_]csharp_align_multiple_declaration
, [resharper_]align_multiple_declaration
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Type parameters list
Property names:
[resharper_]csharp_align_multline_type_parameter_list
, [resharper_]align_multline_type_parameter_list
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Type parameter constraints
Property names:
[resharper_]csharp_align_multline_type_parameter_constrains
, [resharper_]align_multline_type_parameter_constrains
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Outdent commas
Property names:
[resharper_]csharp_outdent_commas
, [resharper_]outdent_commas
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Align similar code in columns
Fix column alignment in adjacent lines
Property names:
[resharper_]csharp_int_align_fix_in_adjacent
, [resharper_]int_align_fix_in_adjacent
When formatting some code, also fix column alignment in adjacent lines if needed
Possible values:
true | false
Fields and constants
Property names:
[resharper_]csharp_int_align_fields
, [resharper_]csharp_int_align
, [resharper_]int_align_fields
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Properties and events
Property names:
[resharper_]csharp_int_align_properties
, [resharper_]csharp_int_align
, [resharper_]int_align_properties
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Simple methods, operators, delegates
Property names:
[resharper_]csharp_int_align_methods
, [resharper_]csharp_int_align
, [resharper_]int_align_methods
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Multiline method signature
Property names:
[resharper_]csharp_int_align_parameters
, [resharper_]csharp_int_align
, [resharper_]int_align_parameters
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Variables and local constants
Property names:
[resharper_]csharp_int_align_variables
, [resharper_]csharp_int_align
, [resharper_]int_align_variables
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Other assignments and initializers
Property names:
[resharper_]csharp_int_align_assignments
, [resharper_]csharp_int_align
, [resharper_]int_align_assignments
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Property patterns
Property names:
[resharper_]csharp_int_align_property_patterns
, [resharper_]csharp_int_align
, [resharper_]int_align_property_patterns
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Nested ternary operators
Property names:
[resharper_]csharp_int_align_nested_ternary
, [resharper_]csharp_int_align
, [resharper_]int_align_nested_ternary
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Invocations of the same method
Property names:
[resharper_]csharp_int_align_invocations
, [resharper_]csharp_int_align
, [resharper_]int_align_invocations
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Binary expressions
Property names:
[resharper_]csharp_int_align_binary_expressions
, [resharper_]csharp_int_align
, [resharper_]int_align_binary_expressions
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
End comments
Property names:
[resharper_]csharp_int_align_comments
, [resharper_]csharp_int_align
, [resharper_]int_align_comments
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Simple switch sections
Property names:
[resharper_]csharp_int_align_switch_sections
, [resharper_]csharp_int_align
, [resharper_]int_align_switch_sections
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Switch expressions
Property names:
[resharper_]csharp_int_align_switch_expressions
, [resharper_]csharp_int_align
, [resharper_]int_align_switch_expressions
, [resharper_]int_align
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|