Skip to content

Commit

Permalink
Add /// <inheritdoc/> to generated type hierarchies
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Mar 25, 2023
1 parent b8df95a commit 3b2d287
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ public CompilationUnitSyntax GetCompilationUnit(
// Create the partial type declaration with the given member declarations.
// This code produces a class declaration as follows:
//
// /// <inheritdoc/>
// partial <TYPE_KIND> TYPE_NAME>
// {
// <MEMBERS>
// }
TypeDeclarationSyntax typeDeclarationSyntax =
Hierarchy[0].GetSyntax()
.AddModifiers(Token(SyntaxKind.PartialKeyword))
.AddModifiers(Token(TriviaList(Comment("/// <inheritdoc/>")), SyntaxKind.PartialKeyword, TriviaList()))
.AddMembers(memberDeclarations.ToArray());

// Add the base list, if present
Expand All @@ -50,7 +51,7 @@ public CompilationUnitSyntax GetCompilationUnit(
{
typeDeclarationSyntax =
parentType.GetSyntax()
.AddModifiers(Token(SyntaxKind.PartialKeyword))
.AddModifiers(Token(TriviaList(Comment("/// <inheritdoc/>")), SyntaxKind.PartialKeyword, TriviaList()))
.AddMembers(typeDeclarationSyntax);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ partial class MyViewModel : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <inheritdoc cref="name"/>
Expand Down Expand Up @@ -98,6 +99,7 @@ public string Name
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <inheritdoc cref="name"/>
Expand Down Expand Up @@ -175,6 +177,7 @@ partial class MyViewModel : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <inheritdoc cref="id"/>
Expand Down Expand Up @@ -252,6 +255,7 @@ partial class MyViewModel<T> : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="content"/>
Expand Down Expand Up @@ -308,6 +312,7 @@ public T Content
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="content"/>
Expand Down Expand Up @@ -390,6 +395,7 @@ partial class MyViewModel<T> : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="content"/>
Expand Down Expand Up @@ -446,6 +452,7 @@ public T Content
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="content"/>
Expand Down Expand Up @@ -525,6 +532,7 @@ partial class MyViewModel<T> : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="content"/>
Expand Down Expand Up @@ -581,6 +589,7 @@ public T Content
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="content"/>
Expand Down Expand Up @@ -659,6 +668,7 @@ partial class MyViewModel<T> : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="content"/>
Expand Down Expand Up @@ -734,6 +744,7 @@ partial class MyViewModel : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <inheritdoc cref="name"/>
Expand Down Expand Up @@ -810,6 +821,7 @@ partial class MyViewModel : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <inheritdoc cref="id"/>
Expand Down Expand Up @@ -886,6 +898,7 @@ partial class MyViewModel<T> : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="content"/>
Expand Down Expand Up @@ -963,6 +976,7 @@ partial class MyViewModel<T> : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="content"/>
Expand Down Expand Up @@ -1040,6 +1054,7 @@ partial class MyViewModel<T> : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="content"/>
Expand Down Expand Up @@ -1133,6 +1148,7 @@ public DefaultValueAttribute(object value)
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <inheritdoc cref="a"/>
Expand Down Expand Up @@ -1238,6 +1254,7 @@ public DefaultValueAttribute(object value)
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <summary>The backing field for <see cref="TestCommand"/>.</summary>
Expand Down Expand Up @@ -1301,6 +1318,7 @@ private partial void Test2()
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <summary>The backing field for <see cref="Test1Command"/>.</summary>
Expand All @@ -1320,6 +1338,7 @@ partial class MyViewModel
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <summary>The backing field for <see cref="Test2Command"/>.</summary>
Expand Down Expand Up @@ -1386,6 +1405,7 @@ public ValueAttribute(object value)
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <summary>The backing field for <see cref="Test1Command"/>.</summary>
Expand All @@ -1409,6 +1429,7 @@ partial class MyViewModel
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class MyViewModel
{
/// <summary>The backing field for <see cref="Test2Command"/>.</summary>
Expand Down Expand Up @@ -1456,8 +1477,10 @@ partial class MyViewModel<T> : ObservableObject
#nullable enable
namespace MyApp
{
/// <inheritdoc/>
partial class Foo
{
/// <inheritdoc/>
partial class MyViewModel<T>
{
/// <inheritdoc cref="a"/>
Expand Down

0 comments on commit 3b2d287

Please sign in to comment.