stevospinks
stevospinks

Reputation: 137

Resharper 2016.1 Formatting method documentation header (XML Doc Comments)

I'm trying to get Resharper to reformat my XML doc comments in a certain way. I want the summary text on a new line, but other tags on a single line. Which is the same format as the Visual Studio placeholder text (when /// is entered).

I've searched StackOverflow and haven't been able to find anything yet.

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>

Is there a way to do this?

Failing that, is there a way to populate the Visual Studio placeholder text with the summary text Resharper generates?

(I've posted this question on the Resharper forums, but haven't had a response yet)

Upvotes: 2

Views: 540

Answers (1)

stevospinks
stevospinks

Reputation: 137

It doesn't seem that this is currently possible in Resharper. It can be done using the Agent Smith plugin, as suggested by Jeremy Morton on my Resharper Support post.

To do this:

  1. Install Agent Smith
  2. In Resharper options, under AgentSmith => Xml Documentation => Reflow And Retag
    • Set <summary> to 'Always'
    • Set everything else to 'Never'
  3. Save your changes.

This can be done on an individual comment, by opening the quick fix window (Ctrl + .) and choosing 'Reflow & Retag Comment [Agent Smith]'.

It can also be set up to make changes to a whole file - during Code Cleanup - by choosing the 'Reflow & Retag XML Documentation Comments' and 'Reflow XML Documentation Comments' options.

Upvotes: 1

Related Questions