ReSharper 2024.2 Help

EditorConfig properties for XML: Formatting Style

Tabs and indents

Indent style

Property names:

indent_style, [resharper_]xml_indent_style

Possible values:

  • tab: Tab

  • space: Spaces

Examples:

tab

<tag1> <tag2> text </tag2> </tag1>

space

<tag1> <tag2> text </tag2> </tag1>

Indent size

Property names:

indent_size, [resharper_]xml_indent_size

Possible values:

an integer

Examples:

value: 0

<tag1> <tag2> text </tag2> </tag1>

value: 1

<tag1> <tag2> text </tag2> </tag1>

value: 2

<tag1> <tag2> text </tag2> </tag1>

Tab width

Property names:

tab_width, [resharper_]xml_tab_width

Possible values:

an integer

Examples:

value: 0

<tag1> <tag2> text </tag2> </tag1>

value: 1

<tag1> <tag2> text </tag2> </tag1>

value: 2

<tag1> <tag2> text </tag2> </tag1>

How to align when tabs are used for indents

Property names:

[resharper_]xml_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

Align even if the resulting indentation is too large

Property names:

[resharper_]xml_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

Line wrapping

Hard wrap at

Property names:

max_line_length, [resharper_]xml_max_line_length

Possible values:

an integer

Wrap tags and processing instructions

Property names:

[resharper_]xml_wrap_tags_and_pi, [resharper_]wrap_tags_and_pi

Possible values:

true | false

Examples:

Before formatting

After formatting, true

<tag attr1='1234567890' attr2='1234567890'/>
<tag attr1='1234567890' attr2='1234567890' />

Before formatting

After formatting, false

<tag attr1='1234567890' attr2='1234567890'/>
<tag attr1='1234567890' attr2='1234567890' />

Processing instructions

Spaces around '=' in attribute

Property names:

[resharper_]xml_spaces_around_eq_in_pi_attribute, [resharper_]spaces_around_eq_in_pi_attribute

Possible values:

true | false

Examples:

true

<?xml version = '1.0' encoding = 'utf-8'?>

false

<?xml version='1.0' encoding='utf-8'?>

Space after last attribute

Property names:

[resharper_]xml_space_after_last_pi_attribute, [resharper_]space_after_last_pi_attribute

Possible values:

true | false

Examples:

true

<?xml version='1.0' encoding='utf-8' ?>

false

<?xml version='1.0' encoding='utf-8'?>

Attributes format

Property names:

[resharper_]xml_pi_attribute_style, [resharper_]pi_attribute_style

Possible values:

  • on_single_line: On single line

  • first_attribute_on_single_line: First attribute on single line

  • on_different_lines: Each attribute on separate lines

  • do_not_touch: Do not touch

Examples:

on_single_line

<?xml version='1.0' encoding='utf-8'?>

first_attribute_on_single_line

<?xml version='1.0' encoding='utf-8'?>

on_different_lines

<?xml version='1.0' encoding='utf-8'?>

do_not_touch

<?xml version='1.0' encoding='utf-8'?>

Attributes indenting

Property names:

[resharper_]xml_pi_attributes_indent, [resharper_]pi_attributes_indent

Possible values:

  • single_indent: Single indent

  • double_indent: Double indent

  • align_by_first_attribute: Align by first attribute

Examples:

single_indent

<?xml version='1.0' encoding='utf-8'?>

double_indent

<?xml version='1.0' encoding='utf-8'?>

align_by_first_attribute

<?xml version='1.0' encoding='utf-8'?>

Blank line after processing instructions

Property names:

[resharper_]xml_blank_line_after_pi, [resharper_]blank_line_after_pi

Possible values:

true | false

Examples:

true

<?xml version='1.0' encoding='utf-8'?> <a />

false

<?xml version='1.0' encoding='utf-8'?> <a />

Inside of tag header

Spaces around '=' in attribute

Property names:

[resharper_]xml_spaces_around_eq_in_attribute, [resharper_]spaces_around_eq_in_attribute

Possible values:

true | false

Examples:

true

<a x = '1' y = '2' z = '3' />

false

<a x='1' y='2' z='3' />

Space after last attribute

Property names:

[resharper_]xml_space_after_last_attribute, [resharper_]space_after_last_attribute

Possible values:

true | false

Examples:

true

<a x='1' y='2' z='3' >text</a>

false

<a x='1' y='2' z='3'>text</a>

Space before '/>'

Property names:

[resharper_]xml_space_before_self_closing, [resharper_]space_before_self_closing

Possible values:

true | false

Examples:

true

<a />

false

<a/>

Attributes format

Property names:

[resharper_]xml_attribute_style, [resharper_]attribute_style

Possible values:

  • on_single_line: On single line

  • first_attribute_on_single_line: First attribute on single line

  • on_different_lines: Each attribute on separate lines

  • do_not_touch: Do not touch

Examples:

on_single_line

<a x='1' y='2' z='3' />

first_attribute_on_single_line

<a x='1' y='2' z='3' />

on_different_lines

<a x='1' y='2' z='3' />

do_not_touch

<a x='1' y='2' z='3' />

Attributes indenting

Property names:

[resharper_]xml_attribute_indent, [resharper_]attribute_indent

Possible values:

  • single_indent: Single indent

  • double_indent: Double indent

  • align_by_first_attribute: Align by first attribute

Examples:

single_indent

<a x='1' y='2' z='3' />

double_indent

<a x='1' y='2' z='3' />

align_by_first_attribute

<a x='1' y='2' z='3' />

Tag content

Keep existing line breaks

Property names:

[resharper_]xml_keep_user_linebreaks, [resharper_]keep_user_linebreaks

Possible values:

true | false

Examples:

Before formatting

After formatting, true

<summary> text more text </summary>
<summary> text more text </summary>

Before formatting

After formatting, false

<summary> text more text </summary>
<summary>text more text</summary>

Line breaks after start-tag and before end-tag in multiline elements

Property names:

[resharper_]xml_linebreaks_inside_tags_for_multiline_elements, [resharper_]linebreaks_inside_tags_for_multiline_elements

Possible values:

true | false

Examples:

true

<tag> text text text Text text text text text text text text text </tag>

false

<tag>text text text Text text text text text text text text text</tag>

Line breaks after start-tag and before end-tag in elements that contain other elements and no text

Property names:

[resharper_]xml_linebreaks_inside_tags_for_elements_with_child_elements, [resharper_]linebreaks_inside_tags_for_elements_with_child_elements

Possible values:

true | false

Examples:

true

<tag> <othertag>text</othertag> </tag>

false

<tag><othertag>text</othertag></tag>

Line breaks after start-tag and before end-tag when element is longer than

Property names:

[resharper_]xml_linebreaks_inside_tags_for_elements_longer_than, [resharper_]linebreaks_inside_tags_for_elements_longer_than

Format long tags like this: <tag> content </tag>

Possible values:

an integer

Spaces after start-tag and before end-tag otherwise

Property names:

[resharper_]xml_spaces_inside_tags, [resharper_]spaces_inside_tags

Possible values:

true | false

Examples:

true

<tag> Text text text text text text text text text </tag>

false

<tag>Text text text text text text text text text</tag>

Wrap inside text

Property names:

[resharper_]xml_wrap_text, [resharper_]wrap_text

Possible values:

true | false

Examples:

Before formatting

After formatting, true

<tag> Text text text text text text text text text </tag>
<tag> Text text text text text text text text text </tag>

Before formatting

After formatting, false

<tag> Text text text text text text text text text </tag>
<tag> Text text text text text text text text text </tag>

Wrap before and after elements

Property names:

[resharper_]xml_wrap_around_elements, [resharper_]wrap_around_elements

Possible values:

true | false

Examples:

Before formatting

After formatting, true

<tag> Text text text text text <tag/> text text text </tag>
<tag> Text text text text text <tag /> text text text </tag>

Before formatting

After formatting, false

<tag> Text text text text text <tag/> text text text </tag>
<tag> Text text text text text <tag /> text text text </tag>

Indent inside element that does not contain text

Property names:

[resharper_]xml_indent_child_elements, [resharper_]indent_child_elements

Possible values:

  • DoNotTouch: Do not change indenting

  • do_not_touch: Do not change indenting

  • OneIndent: One indent from parent element

  • one_indent: One indent from parent element

  • ZeroIndent: No indent from parent element

  • zero_indent: No indent from parent element

  • RemoveIndent: No indent at all

  • remove_indent: No indent at all

Examples:

DoNotTouch

<toplevel> <summary> <tag /> <tag /> </summary> </toplevel>

do_not_touch

<toplevel> <summary> <tag /> <tag /> </summary> </toplevel>

OneIndent

<toplevel> <summary> <tag /> <tag /> </summary> </toplevel>

one_indent

<toplevel> <summary> <tag /> <tag /> </summary> </toplevel>

ZeroIndent

<toplevel> <summary> <tag /> <tag /> </summary> </toplevel>

zero_indent

<toplevel> <summary> <tag /> <tag /> </summary> </toplevel>

RemoveIndent

<toplevel> <summary> <tag /> <tag /> </summary> </toplevel>

remove_indent

<toplevel> <summary> <tag /> <tag /> </summary> </toplevel>

Indent inside element that contains text

Property names:

[resharper_]xml_indent_text, [resharper_]indent_text

Possible values:

  • DoNotTouch: Do not change indenting

  • do_not_touch: Do not change indenting

  • OneIndent: One indent from parent element

  • one_indent: One indent from parent element

  • ZeroIndent: No indent from parent element

  • zero_indent: No indent from parent element

  • RemoveIndent: No indent at all

  • remove_indent: No indent at all

Examples:

DoNotTouch

<toplevel> <summary> text1 text2 </summary> </toplevel>

do_not_touch

<toplevel> <summary> text1 text2 </summary> </toplevel>

OneIndent

<toplevel> <summary> text1 text2 </summary> </toplevel>

one_indent

<toplevel> <summary> text1 text2 </summary> </toplevel>

ZeroIndent

<toplevel> <summary> text1 text2 </summary> </toplevel>

zero_indent

<toplevel> <summary> text1 text2 </summary> </toplevel>

RemoveIndent

<toplevel> <summary> text1 text2 </summary> </toplevel>

remove_indent

<toplevel> <summary> text1 text2 </summary> </toplevel>

Around tags

Maximum blank lines between tags

Property names:

[resharper_]xml_max_blank_lines_between_tags, [resharper_]max_blank_lines_between_tags

Maximum blank lines between tags

Possible values:

an integer

Place multiline elements on a new line

Property names:

[resharper_]xml_linebreak_before_multiline_elements, [resharper_]linebreak_before_multiline_elements

Possible values:

true | false

Examples:

true

<exception> Text <tag> text </tag> text </exception>

false

<exception> Text <tag> text </tag> text </exception>

Place single-line elements on a new line

Property names:

[resharper_]xml_linebreak_before_singleline_elements, [resharper_]linebreak_before_singleline_elements

Possible values:

true | false

Examples:

true

<exception> See <see cref="something" /> for more info </exception>

false

<exception> See <see cref="something" /> for more info </exception>

Other

Line feed at end of file

Property names:

insert_final_newline, [resharper_]xml_insert_final_newline

Possible values:

true | false

Last modified: 26 May 2024