How to configure R# and StyleCop to reformat XML documents in this particular manner?

Sep 24, 2013 at 9:17 PM

I'm running VS2012 + Resharper8.01 + StyleCop 4.7.45.

I'm trying to get resharper code-cleanup pass to reformat my xmldoc comments in this particular way:
  • Summary and Remarks must always be multi-line
  • Param and TypeParam must always be single-line (well, at least if they are short).
For example, it would look like this:
/// <summary>
/// Summaries in their own lines
/// </summary>
/// <typeparam name="T">TypeParam in a single line.</typeparam>
public class Foo<T> 
I seem to be unable to find a combination that makes this work, so any help would be appreciated.

I've tried a number of combinations, but I seem to end up with either this, with "StyleCop->Use single lines for declaration headers" ON:
/// <summary>
/// This summary is in its own line, that's what I want.
/// </summary>
/// <typeparam name="T">
/// I don't want this in its own line.
/// </typeparam>
public class Foo<T> 
Or this, with "StyleCop->Use single lines for declaration headers" OFF:
/// <summary>Bummer, I don't want summary in a single line.</summary>
/// <typeparam name="T">Single line for this, ok.</typeparam>
public class Foo<T> 
In R#, I have "XMLDoc->Formatting Style->Place these elements on new line regardless" set to "summary,remarks,example,para". I was hoping that would keep them in new lines, but that doesn't seem to be the case.

I have a feeling that StyleCop is reformatting the code but doesn't take all the R# settings into account, or something like that.

I've asked R# support for help but they said R# doesn't support that out of the box and maybe StyleCop would.

So, is there any way to get the reformating I want?
I mean, other than me writing an extra R# plug-in. :-)

Oct 17, 2013 at 1:15 PM
I'm also looking for exactly this! Does anyone has a suggestion?
Oct 17, 2013 at 8:57 PM
R# support told me they currently do not have an option to change this.
Perhaps the best option at this point is to disable R# reformatting of xmldocs and then use GhostDoc to deal with it.
Not optimal, of course...
Oct 17, 2013 at 9:44 PM
I'm not sure if its still supported, but have you tried using something like the Agent Smith plugin?