Formatting method documentation header (XML Doc Comments)

I'm trying to reformat my XML doc comments so that the summary text is on a new line, but other tags are not. This is how the Visual Studio placeholder text is formatted (when '///' is entered).

Is there a way to do this? Failing that, is there a way to populate the VS placeholder text with Resharper's summary text?

If my explanation hasn't been clear enough, this is what I mean:

Before cleanup:

/// <summary>This is a summary</summary>
/// <param name="object">An object</param>

After cleanup (currently):

/// <summary>
/// This is a summary
/// </summary>
/// <param name="object">
/// An object
/// </param>

After cleanup (desired):

/// <summary>
/// This is a summary
/// </summary>
/// <param name="object">An object</param>
3 comments
Comment actions Permalink

The Agent Smith plugin does this sort of thing.

1
Comment actions Permalink

Thanks Jeremy.

For anyone that wants to set this up too, here are the steps to follow:

  1. Set up Resharper to format the XML doc comments as in the 'Before cleanup' section in the question
  2. Run Code Cleanup on your file (you may need to add a custom profile to modify the comments)
  3. Install Agent Smith
  4. In Resharper options, under AgentSmith => Xml Documentation => Reflow And Retag
    • Set <summary> to 'Always'
    • Set everything else to 'Never'
  5. Save the options and navigate to a code comment
  6. Open the quick fix window (Ctrl + .) and choose 'Reflow & Retag Comment [Agent Smith]'.

Unfortunately it seems that this needs to be done for each comment individually.

0
Comment actions Permalink

Code Cleanup has options to use Agent Smith for Code Cleanup instead of ReSharper's built in XML doc comment reformatting.

1

Please sign in to leave a comment.