Limit XML comment lines to 80 characters


I would like ReSharper to limit XML comment lines to 80 columns when I run code cleanup.

For example, I would like the following line:

        /// <summary>Transform a dictionary into an HTTP entity by serializing it to JSON</summary>

To be reformatted to

        /// <summary>Transform a dictionary into an HTTP entity by serializing
        /// it to JSON</summary>

The following would also be acceptable:

        /// <summary>
        /// Transform a dictionary into an HTTP entity by serializing it to JSON
        /// </summary>

However, if the line is short, I do not want the tags to be on separate lines. The following line should not be broken up:

/// <param name="paramName">A short description</param>

Here are the relevant lines from my .DotSettings file:

    <s:String x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/IndentTagContent/@EntryValue">ZeroIndent</s:String>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/KeepUserLineBreaks/@EntryValue">False</s:Boolean>
    <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/TagSpaceBeforeHeaderEnd1/@EntryValue">False</s:Boolean>
    <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/WRAP_LIMIT/@EntryValue">80</s:Int64>

How can I achieve this?


Hello Rmartin, thank you for your question. The settings seem to be correct. The only thing I would change is to make the WRAP_LIMIT (ReSharper | Options | Code Editing | XML Doc Comments | Formatting Style | Line wrapping | Hard wrap at) a little less so that the line that you gave as an example would be transferred to another line. Please let me know what you think.


WRAP_LIMIT is set according to my employer's style guide so that lines exceeding 80 columns will be wrapped (though whether the WRAP_LIMIT is in columns or characters is unclear). The example I gave is 99 columns (93 characters including two leading tabs that are 4 columns wide). Clearly it line exceeds the WRAP_LIMIT, so why is it not wrapped?


Rmartin, thanks for the reply. The characters inside the <summary> tag are counted. And there are less than 80.


Thank you for your explanation. Is there no way to limit the entire line, including indentation and XML tags, to 80 columns, then?


Rmartin, I'm afraid there is no such way. I found the following issue on our bug tracker that describes a similar case: Please comment or vote for it to get notifications about status changes. Thank you!


Please sign in to leave a comment.