I used Ghostdoc Free, a year ago in Visual Studio 2015, and really liked what it did, and decided to purchase it. I now have to use Visual Studio 2012 and noticed that comments for classes are not as good as before.
It now just says:
/// The ClassName class.
whereas before it would distinguish between classes that implements interfaces with something like:
/// Implements the <see cref="IInterfaceName"
I looked into the Rules, but I'm not sure how to extract the name(s) of the interfaces. I now have this:
/// Generates the summary documentation of the class.
private void GenerateSummaryDocumentation()
{
// Assign the current code element.
var codeElement = Context.CurrentCodeElement;
// If the class appears to be a base class.
if (codeElement.Name.EndsWith("Base"))
{
// Write the summary documentation of the class.
this.WriteLine("Provides a base class to derive {0} of.", Context.ExecMacro("$(TypeName.Words.All)"));
}
else
{
if (codeElement.HasBaseTypes)
{
var baseType = codeElement.BaseTypes[0];
baseType = baseType.Substring(baseType.LastIndexOf(".") + 1);
this.WriteLine("Implementation of {0}", baseType);
}
else
{
// Write the summary documentation of the class.
this.WriteLine("Provides a class that implements a {0}", Context.ExecMacro("$(TypeName.Words.All)"));
}
}
return;
}
Which results in this:
/// Provides a class that implements a class name which is just taking the class name and splitting it. And /// Implementation of IInterfaceName which is a bit blunt (in case of multiple interfaces)
Any examples out there that would insert the interface name here?
The codeElement.BaseTypes[0] in the rule's Template should have returned the interface name for the generated comment.
We are happy to help you troubleshoot this issue, please email us at support at submain dot com
Thanks!