Skip to content

Commit 1ca30ff

Browse files
committed
Add generated XML docs to __ObservableValidatorExtensions
1 parent 873c1c3 commit 1ca30ff

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservableValidatorValidateAllPropertiesGenerator.Execute.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ public static CompilationUnitSyntax GetSyntax(bool isDynamicallyAccessedMembersA
9696

9797
// Prepare the base attributes with are always present:
9898
//
99+
// /// <summary>
100+
// /// A helper type with generated validation stubs for types deriving from <see cref="global::CommunityToolkit.Mvvm.ComponentModel.ObservableValidator"/>.
101+
// /// </summary>
99102
// [global::System.CodeDom.Compiler.GeneratedCode("...", "...")]
100103
// [global::System.Diagnostics.DebuggerNonUserCode]
101104
// [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
@@ -105,7 +108,11 @@ public static CompilationUnitSyntax GetSyntax(bool isDynamicallyAccessedMembersA
105108
AttributeList(SingletonSeparatedList(
106109
Attribute(IdentifierName($"global::System.CodeDom.Compiler.GeneratedCode")).AddArgumentListArguments(
107110
AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(typeof(ObservableValidatorValidateAllPropertiesGenerator).FullName))),
108-
AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(typeof(ObservableValidatorValidateAllPropertiesGenerator).Assembly.GetName().Version.ToString())))))));
111+
AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(typeof(ObservableValidatorValidateAllPropertiesGenerator).Assembly.GetName().Version.ToString()))))))
112+
.WithOpenBracketToken(Token(TriviaList(
113+
Comment("/// <summary>"),
114+
Comment("/// A helper type with generated validation stubs for types deriving from <see cref=\"global::CommunityToolkit.Mvvm.ComponentModel.ObservableValidator\"/>."),
115+
Comment("/// </summary>")), SyntaxKind.OpenBracketToken, TriviaList())));
109116
attributes.Add(AttributeList(SingletonSeparatedList(Attribute(IdentifierName("global::System.Diagnostics.DebuggerNonUserCode")))));
110117
attributes.Add(AttributeList(SingletonSeparatedList(Attribute(IdentifierName("global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage")))));
111118
attributes.Add(
@@ -176,8 +183,14 @@ public static CompilationUnitSyntax GetSyntax(ValidationInfo validationInfo)
176183
// #pragma warning disable
177184
// namespace CommunityToolkit.Mvvm.ComponentModel.__Internals
178185
// {
186+
// /// <inheritdoc/>
179187
// partial class __ObservableValidatorExtensions
180188
// {
189+
// /// <summary>
190+
// /// Creates a validation stub for <see cref="<INSTANCE_TYPE>"/> objects.
191+
// /// </summary>
192+
// /// <param name="_">Dummy parameter, only used to disambiguate the method signature.</param>
193+
// /// <returns>A validation stub for <see cref="<INSTANCE_TYPE>"/> objects.</returns>
181194
// [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
182195
// [global::System.Obsolete("This method is not intended to be called directly by user code")]
183196
// public static global::System.Action<object> CreateAllPropertiesValidator(<INSTANCE_TYPE> _)
@@ -197,13 +210,20 @@ public static CompilationUnitSyntax GetSyntax(ValidationInfo validationInfo)
197210
NamespaceDeclaration(IdentifierName("CommunityToolkit.Mvvm.ComponentModel.__Internals")).WithLeadingTrivia(TriviaList(
198211
Comment("// <auto-generated/>"),
199212
Trivia(PragmaWarningDirectiveTrivia(Token(SyntaxKind.DisableKeyword), true)))).AddMembers(
200-
ClassDeclaration("__ObservableValidatorExtensions").AddModifiers(Token(SyntaxKind.PartialKeyword)).AddMembers(
213+
ClassDeclaration("__ObservableValidatorExtensions").AddModifiers(
214+
Token(TriviaList(Comment("/// <inheritdoc/>")), SyntaxKind.PartialKeyword, TriviaList())).AddMembers(
201215
MethodDeclaration(
202216
GenericName("global::System.Action").AddTypeArgumentListArguments(PredefinedType(Token(SyntaxKind.ObjectKeyword))),
203217
Identifier("CreateAllPropertiesValidator")).AddAttributeLists(
204218
AttributeList(SingletonSeparatedList(
205219
Attribute(IdentifierName("global::System.ComponentModel.EditorBrowsable")).AddArgumentListArguments(
206-
AttributeArgument(ParseExpression("global::System.ComponentModel.EditorBrowsableState.Never"))))),
220+
AttributeArgument(ParseExpression("global::System.ComponentModel.EditorBrowsableState.Never")))))
221+
.WithOpenBracketToken(Token(TriviaList(
222+
Comment("/// <summary>"),
223+
Comment($"/// Creates a validation stub for <see cref=\"{validationInfo.TypeName}\"/> objects."),
224+
Comment("/// </summary>"),
225+
Comment("/// <param name=\"_\">Dummy parameter, only used to disambiguate the method signature.</param>"),
226+
Comment($"/// <returns>A validation stub for <see cref=\"{validationInfo.TypeName}\"/> objects.</returns>")), SyntaxKind.OpenBracketToken, TriviaList())),
207227
AttributeList(SingletonSeparatedList(
208228
Attribute(IdentifierName("global::System.Obsolete")).AddArgumentListArguments(
209229
AttributeArgument(LiteralExpression(

0 commit comments

Comments
 (0)