codemaid icon indicating copy to clipboard operation
codemaid copied to clipboard

Reorder xml documentation `param` tags, to match the order of method params

Open hyankov opened this issue 6 years ago • 2 comments

Environment

  • Visual Studio version: 2019 Professional
  • CodeMaid version: 11.1.209
  • Code language: C#

Description

This is a feature request - CodeMaid should/could reorder the param XML comments, to match the order of the actual method parameters.

Steps to recreate

Given:

public class MyClass
{
		/// <summary>
		/// ...
		/// </summary>
		/// <param name="param2">Param 2.</param>
		/// <param name="param1">Param 1.</param>
		/// <returns>...</returns>
		public int SomeMethod(string param1, string param2) { }
}

When you clean-up this code, it should change to:

public class MyClass
{
		/// <summary>
		/// ...
		/// </summary>
		/// <param name="param1">Param 1.</param>
		/// <param name="param2">Param 2.</param>
		/// <returns>...</returns>
		public int SomeMethod(string param1, string param2) { }
}

Current behavior

Right now CodeMaid does not change the order of param, to match the method order of params.

Expected behavior

On clean-up, CodeMaid changes the order of param tags, to match the order of method params.

hyankov avatar Sep 14 '20 15:09 hyankov

Thanks for the suggestion!

@willemduncan any thoughts?

codecadwallader avatar Sep 30 '20 12:09 codecadwallader

Great idea, fully support it. Needs a decision or setting what to do with <param> comments that are no longer present (keep/remove), and optionally with parameters in code that do not exist in the comment (nothing/auto-add).

It does however require the comment formatting code to be context aware, which it currently isn't, and I do not see it happening in the current incarnation. This is more something for a Roslyn version.

w5l avatar Oct 23 '20 05:10 w5l