user2324540
user2324540

Reputation:

Resharper indenting the XML documentation text on code cleanup?

I am using Resharper 7.1 with the StyleCop plugin.

I am not sure if this is a bug, but, I am confused because the code cleanup behaves differently when text is selected prior to the cleanup operation.

If I do a simple code cleanup on a C# source file, here is what my XML documentation look like :

/// <summary>
/// This is a summary
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// e.
/// </param>

However, if i select the XML text and launch a code cleanup on that selected text, take a look at how the code cleanup has indented the text between the tags :

/// <summary>
///     This is a summary
/// </summary>
/// <param name="sender">
///     The sender.
/// </param>
/// <param name="e">
///     e.
/// </param>

Upvotes: 42

Views: 6697

Answers (2)

Dmitry Osinovskiy
Dmitry Osinovskiy

Reputation: 10118

In ReSharper 8.0 (latest EAP) without StyleCop, go to ReSharper | Options -> Code Editing | XML Doc Comments | Formatting Style, and in section Tag content find two options named Indent inside element.... Set them to No indent at all to avoid indentation. I don't know if that would work with StyleCop.

In JetBrains Rider, the same setting can be found at File | Settings (Options on Mac) -> Editor -> Code Style -> C# | XML documentation

Upvotes: 61

Nipun Ambastha
Nipun Ambastha

Reputation: 2573

Resharper is quite funny at times and considering what it does is like banging head to the wall :P

I too faced same issue and ended up using this tool http://visualstudiogallery.msdn.microsoft.com/46A20578-F0D5-4B1E-B55D-F001A6345748

Its really awesome, once installed, select property, class, method and do ctrl+shift+D and you can see the wonder.

Hope this helps.

Upvotes: 1

Related Questions