Resharper indenting the XML documentation text on code cleanup?
Asked Answered
N

2

42

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>
  • What is the real StyleCop way of generating XML documentation ? Indented text or not ?

  • How can I configure Resharper to avoid or force that indentation ?

Natishanative answered 14/5, 2013 at 0:24 Comment(0)
S
60

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

Submersed answered 16/6, 2013 at 12:24 Comment(0)
C
1

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.

Carmeliacarmelina answered 17/5, 2013 at 5:38 Comment(1)
Good suggestion. I already tried GhostDoc and despite it does a good job, that doesn't really answer my question. I would like to be able to solve the Resharper problem. Thanks anyway.Natishanative

© 2022 - 2024 — McMap. All rights reserved.