Skip to content

Commit c71eb35

Browse files
authored
Merge pull request #124 from CommunityToolkit/dev/observable-property-inheritdoc
Add <inheritdoc/> to generated observable properties
2 parents d9c315c + 4a004a4 commit c71eb35

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservablePropertyGenerator.Execute.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ public static MemberDeclarationSyntax GetSyntax(PropertyInfo propertyInfo)
258258

259259
// Construct the generated property as follows:
260260
//
261+
// /// <inheritdoc cref="<FIELD_NAME>"/>
261262
// [global::System.CodeDom.Compiler.GeneratedCode("...", "...")]
262263
// [global::System.Diagnostics.DebuggerNonUserCode]
263264
// [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
@@ -277,7 +278,8 @@ public static MemberDeclarationSyntax GetSyntax(PropertyInfo propertyInfo)
277278
Attribute(IdentifierName("global::System.CodeDom.Compiler.GeneratedCode"))
278279
.AddArgumentListArguments(
279280
AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(typeof(ObservablePropertyGenerator).FullName))),
280-
AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(typeof(ObservablePropertyGenerator).Assembly.GetName().Version.ToString())))))),
281+
AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(typeof(ObservablePropertyGenerator).Assembly.GetName().Version.ToString()))))))
282+
.WithOpenBracketToken(Token(TriviaList(Comment($"/// <inheritdoc cref=\"{propertyInfo.FieldName}\"/>")), SyntaxKind.OpenBracketToken, TriviaList())),
281283
AttributeList(SingletonSeparatedList(Attribute(IdentifierName("global::System.Diagnostics.DebuggerNonUserCode")))),
282284
AttributeList(SingletonSeparatedList(Attribute(IdentifierName("global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage")))))
283285
.AddAttributeLists(validationAttributes.ToArray())

CommunityToolkit.Mvvm.SourceGenerators/Input/ICommandGenerator.Execute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static ImmutableArray<MemberDeclarationSyntax> GetSyntax(CommandInfo comm
119119

120120
// Construct the generated field as follows:
121121
//
122-
// <summary>The backing field for <see cref="<COMMAND_PROPERTY_NAME>"/></summary>
122+
// /// <summary>The backing field for <see cref="<COMMAND_PROPERTY_NAME>"/></summary>
123123
// [global::System.CodeDom.Compiler.GeneratedCode("...", "...")]
124124
// private <COMMAND_TYPE>? <COMMAND_FIELD_NAME>;
125125
FieldDeclarationSyntax fieldDeclaration =
@@ -191,7 +191,7 @@ public static ImmutableArray<MemberDeclarationSyntax> GetSyntax(CommandInfo comm
191191

192192
// Construct the generated property as follows (the explicit delegate cast is needed to avoid overload resolution conflicts):
193193
//
194-
// <summary>Gets an <see cref="<COMMAND_INTERFACE_TYPE>" instance wrapping <see cref="<METHOD_NAME>"/> and <see cref="<OPTIONAL_CAN_EXECUTE>"/>.</summary>
194+
// /// <summary>Gets an <see cref="<COMMAND_INTERFACE_TYPE>" instance wrapping <see cref="<METHOD_NAME>"/> and <see cref="<OPTIONAL_CAN_EXECUTE>"/>.</summary>
195195
// [global::System.CodeDom.Compiler.GeneratedCode("...", "...")]
196196
// [global::System.Diagnostics.DebuggerNonUserCode]
197197
// [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]

0 commit comments

Comments
 (0)