Skip to content

Commit 1d32cf8

Browse files
CopiloteNeRGy164
andauthored
Add comprehensive XML documentation for IDE IntelliSense support
* Add comprehensive XML documentation to all public APIs Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: eNeRGy164 <10671831+eNeRGy164@users.noreply.github.com>
1 parent 8cb5ed1 commit 1d32cf8

7 files changed

+166
-0
lines changed

src/DendroDocs.Client/DendroDocs.Client.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<PackageIcon>icon.png</PackageIcon>
1717
<PackageReadmeFile>README.md</PackageReadmeFile>
1818

19+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1920
<IncludeSymbols>true</IncludeSymbols>
2021
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2122
</PropertyGroup>

src/DendroDocs.Client/Extensions/IEnumerableIAttributeDescriptionExtensions.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
namespace DendroDocs.Extensions;
22

3+
/// <summary>
4+
/// Provides extension methods for working with collections of attribute descriptions.
5+
/// </summary>
36
public static class IEnumerableIAttributeDescriptionExtensions
47
{
8+
/// <summary>
9+
/// Filters the collection to return only attribute descriptions of the specified type.
10+
/// </summary>
11+
/// <param name="list">The collection of attribute descriptions to filter.</param>
12+
/// <param name="fullname">The full type name of the attribute to match.</param>
13+
/// <returns>A read-only list containing only the attribute descriptions of the specified type.</returns>
14+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="list"/> is <c>null</c>.</exception>
515
public static IReadOnlyList<AttributeDescription> OfType(this IEnumerable<AttributeDescription> list, string fullname)
616
{
717
ArgumentNullException.ThrowIfNull(list);
818

919
return [.. list.Where(ad => string.Equals(ad.Type, fullname, StringComparison.Ordinal))];
1020
}
1121

22+
/// <summary>
23+
/// Determines whether the collection contains an attribute of the specified type.
24+
/// </summary>
25+
/// <param name="list">The collection of attribute descriptions to check.</param>
26+
/// <param name="fullname">The full type name of the attribute to search for.</param>
27+
/// <returns><c>true</c> if an attribute of the specified type is found; otherwise, <c>false</c>.</returns>
1228
public static bool HasAttribute(this IEnumerable<AttributeDescription> list, string fullname)
1329
{
1430
return list.OfType(fullname).Any();

src/DendroDocs.Client/Extensions/IEnumerableMethodDescriptionExtensions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
namespace DendroDocs.Extensions;
22

3+
/// <summary>
4+
/// Provides extension methods for working with collections of method descriptions.
5+
/// </summary>
36
public static class IEnumerableMethodDescriptionExtensions
47
{
8+
/// <summary>
9+
/// Filters the collection to return only method descriptions with the specified name.
10+
/// </summary>
11+
/// <param name="list">The collection of method descriptions to filter.</param>
12+
/// <param name="name">The method name to match.</param>
13+
/// <returns>A read-only list containing only the method descriptions with the specified name.</returns>
14+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="list"/> is <c>null</c>.</exception>
515
public static IReadOnlyList<MethodDescription> WithName(this IEnumerable<MethodDescription> list, string name)
616
{
717
ArgumentNullException.ThrowIfNull(list);

src/DendroDocs.Client/Extensions/IEnumerableStringExtensions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
namespace DendroDocs.Extensions;
22

3+
/// <summary>
4+
/// Provides extension methods for working with collections of string values.
5+
/// </summary>
36
public static class IEnumerableStringExtensions
47
{
8+
/// <summary>
9+
/// Filters the collection to return only strings that start with the specified prefix.
10+
/// </summary>
11+
/// <param name="list">The collection of strings to filter.</param>
12+
/// <param name="partialName">The prefix to match against.</param>
13+
/// <returns>A read-only list containing only the strings that start with the specified prefix.</returns>
14+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="list"/> or <paramref name="partialName"/> is <c>null</c>.</exception>
515
public static IReadOnlyList<string> StartsWith(this IEnumerable<string> list, string partialName)
616
{
717
ArgumentNullException.ThrowIfNull(list);

src/DendroDocs.Client/Extensions/IEnumerableTypeDescriptionExtensions.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,47 @@
11
namespace DendroDocs.Extensions;
22

3+
/// <summary>
4+
/// Provides extension methods for working with collections of type descriptions, including type lookup,
5+
/// inheritance analysis, method invocation tracing, and member population.
6+
/// </summary>
37
public static class IEnumerableTypeDescriptionExtensions
48
{
9+
/// <summary>
10+
/// Finds the first type description with the specified full name.
11+
/// </summary>
12+
/// <param name="types">The collection of type descriptions to search.</param>
13+
/// <param name="typeName">The full name of the type to find.</param>
14+
/// <returns>The first type description with the specified name.</returns>
15+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="types"/> is <c>null</c>.</exception>
16+
/// <exception cref="InvalidOperationException">Thrown when no type with the specified name is found.</exception>
517
public static TypeDescription First(this IEnumerable<TypeDescription> types, string typeName)
618
{
719
ArgumentNullException.ThrowIfNull(types);
820

921
return types.First(t => string.Equals(t.FullName, typeName, StringComparison.Ordinal));
1022
}
1123

24+
/// <summary>
25+
/// Finds the first type description with the specified full name, or returns <c>null</c> if not found.
26+
/// </summary>
27+
/// <param name="types">The collection of type descriptions to search.</param>
28+
/// <param name="typeName">The full name of the type to find.</param>
29+
/// <returns>The first type description with the specified name, or <c>null</c> if not found.</returns>
30+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="types"/> is <c>null</c>.</exception>
1231
public static TypeDescription? FirstOrDefault(this IEnumerable<TypeDescription> types, string typeName)
1332
{
1433
ArgumentNullException.ThrowIfNull(types);
1534

1635
return types.FirstOrDefault(t => string.Equals(t.FullName, typeName, StringComparison.Ordinal));
1736
}
1837

38+
/// <summary>
39+
/// Finds method bodies that match the specified method invocation.
40+
/// </summary>
41+
/// <param name="types">The collection of type descriptions to search.</param>
42+
/// <param name="invocation">The method invocation to match against.</param>
43+
/// <returns>A read-only list of method bodies that match the invocation. Returns an empty list if no matches are found.</returns>
44+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="types"/> is <c>null</c>.</exception>
1945
public static IReadOnlyList<IHaveAMethodBody> GetInvokedMethod(this IEnumerable<TypeDescription> types, InvocationDescription invocation)
2046
{
2147
ArgumentNullException.ThrowIfNull(types);
@@ -29,6 +55,13 @@ public static IReadOnlyList<IHaveAMethodBody> GetInvokedMethod(this IEnumerable<
2955
return [.. type.MethodBodies().Where(invocation.MatchesMethod)];
3056
}
3157

58+
/// <summary>
59+
/// Recursively traces all method invocations that result from executing the specified invocation.
60+
/// </summary>
61+
/// <param name="types">The collection of type descriptions to search.</param>
62+
/// <param name="invocation">The initial method invocation to trace.</param>
63+
/// <returns>A read-only list of all invocations in the call chain, including the original invocation.</returns>
64+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="types"/> is <c>null</c>.</exception>
3265
public static IReadOnlyList<InvocationDescription> GetInvocationConsequences(this IEnumerable<TypeDescription> types, InvocationDescription invocation)
3366
{
3467
ArgumentNullException.ThrowIfNull(types);
@@ -42,6 +75,13 @@ public static IReadOnlyList<InvocationDescription> GetInvocationConsequences(thi
4275
return consequences;
4376
}
4477

78+
/// <summary>
79+
/// Gets all statements that result from executing the specified method invocation, including nested statements from called methods.
80+
/// </summary>
81+
/// <param name="types">The collection of type descriptions to search.</param>
82+
/// <param name="invocation">The method invocation to analyze.</param>
83+
/// <returns>A read-only list of all statements that result from the invocation, including the invocation itself.</returns>
84+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="types"/> is <c>null</c>.</exception>
4585
public static IReadOnlyList<Statement> GetInvocationConsequenceStatements(this IEnumerable<TypeDescription> types, InvocationDescription invocation)
4686
{
4787
ArgumentNullException.ThrowIfNull(types);
@@ -55,6 +95,13 @@ public static IReadOnlyList<Statement> GetInvocationConsequenceStatements(this I
5595
return consequences;
5696
}
5797

98+
/// <summary>
99+
/// Recursively traverses and expands complex statements (like switches and conditional statements) to include all nested statements.
100+
/// </summary>
101+
/// <param name="types">The collection of type descriptions to use for method resolution.</param>
102+
/// <param name="sourceStatement">The statement to traverse and expand.</param>
103+
/// <returns>A read-only list of statements with expanded nested structures. For simple statements, returns an empty list.</returns>
104+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="types"/> is <c>null</c>.</exception>
58105
public static IReadOnlyList<Statement> TraverseStatement(this IEnumerable<TypeDescription> types, Statement sourceStatement)
59106
{
60107
ArgumentNullException.ThrowIfNull(types);
@@ -107,6 +154,12 @@ public static IReadOnlyList<Statement> TraverseStatement(this IEnumerable<TypeDe
107154
}
108155
}
109156

157+
/// <summary>
158+
/// Populates the inheritance hierarchy for all types by adding inherited base types recursively.
159+
/// This method modifies the BaseTypes collection of each type to include all inherited types from the inheritance chain.
160+
/// </summary>
161+
/// <param name="types">The collection of type descriptions to process.</param>
162+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="types"/> is <c>null</c>.</exception>
110163
public static void PopulateInheritedBaseTypes(this IEnumerable<TypeDescription> types)
111164
{
112165
ArgumentNullException.ThrowIfNull(types);
@@ -141,6 +194,15 @@ private static void PopulateInheritedBaseTypes(this IEnumerable<TypeDescription>
141194
}
142195
}
143196

197+
/// <summary>
198+
/// Populates inherited members (fields, properties, methods, constructors, enum members, and events) from base types into derived types.
199+
/// This method adds non-private members from base types to derived types if they are not already present.
200+
/// </summary>
201+
/// <param name="types">The collection of type descriptions to process.</param>
202+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="types"/> is <c>null</c>.</exception>
203+
/// <remarks>
204+
/// This is a simplified inheritance implementation that does not handle complex scenarios like method overrides or hiding.
205+
/// </remarks>
144206
public static void PopulateInheritedMembers(this IEnumerable<TypeDescription> types)
145207
{
146208
ArgumentNullException.ThrowIfNull(types);

src/DendroDocs.Client/Extensions/InvocationDescriptionExtensions.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
namespace DendroDocs.Extensions;
22

3+
/// <summary>
4+
/// Provides extension methods for working with method invocation descriptions and matching them against method definitions.
5+
/// </summary>
36
public static class InvocationDescriptionExtensions
47
{
8+
/// <summary>
9+
/// Determines whether the specified invocation matches the given method definition.
10+
/// </summary>
11+
/// <param name="invocation">The method invocation to check.</param>
12+
/// <param name="method">The method definition to match against.</param>
13+
/// <returns><c>true</c> if the invocation matches the method name and parameters; otherwise, <c>false</c>.</returns>
14+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="invocation"/> or <paramref name="method"/> is <c>null</c>.</exception>
515
public static bool MatchesMethod(this InvocationDescription invocation, IHaveAMethodBody method)
616
{
717
ArgumentNullException.ThrowIfNull(invocation);
@@ -10,6 +20,13 @@ public static bool MatchesMethod(this InvocationDescription invocation, IHaveAMe
1020
return string.Equals(invocation.Name, method.Name) && invocation.MatchesParameters(method);
1121
}
1222

23+
/// <summary>
24+
/// Determines whether the parameters of the specified invocation match the given method definition.
25+
/// </summary>
26+
/// <param name="invocation">The method invocation to check.</param>
27+
/// <param name="method">The method definition to match against.</param>
28+
/// <returns><c>true</c> if the invocation parameters match the method parameters, considering optional parameters; otherwise, <c>false</c>.</returns>
29+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="invocation"/> or <paramref name="method"/> is <c>null</c>.</exception>
1330
public static bool MatchesParameters(this InvocationDescription invocation, IHaveAMethodBody method)
1431
{
1532
ArgumentNullException.ThrowIfNull(invocation);

src/DendroDocs.Client/Extensions/StringExtensions.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
namespace DendroDocs.Extensions;
22

3+
/// <summary>
4+
/// Provides extension methods for string operations related to type analysis and formatting.
5+
/// </summary>
36
public static class StringExtensions
47
{
8+
/// <summary>
9+
/// Determines whether the specified type name represents an enumerable collection type.
10+
/// </summary>
11+
/// <param name="type">The full type name to check.</param>
12+
/// <returns><c>true</c> if the type is an enumerable collection; otherwise, <c>false</c>.</returns>
13+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="type"/> is <c>null</c>.</exception>
514
public static bool IsEnumerable(this string type)
615
{
716
ArgumentNullException.ThrowIfNull(type);
@@ -22,13 +31,31 @@ public static bool IsEnumerable(this string type)
2231
return !type.Contains("Enumerator") && !type.Contains("Compar") && !type.Contains("Structural") && !type.Contains("Provider");
2332
}
2433

34+
/// <summary>
35+
/// Determines whether the specified type name represents a generic type.
36+
/// </summary>
37+
/// <param name="type">The type name to check for generic type indicators.</param>
38+
/// <returns><c>true</c> if the type is generic (contains angle brackets); otherwise, <c>false</c>.</returns>
39+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="type"/> is <c>null</c>.</exception>
2540
public static bool IsGeneric(this string type)
2641
{
2742
ArgumentNullException.ThrowIfNull(type);
2843

2944
return type.IndexOf('>') > -1 && type.TrimEnd().EndsWith('>');
3045
}
3146

47+
/// <summary>
48+
/// Extracts the generic type arguments from a generic type name.
49+
/// </summary>
50+
/// <param name="type">The generic type name to parse.</param>
51+
/// <returns>A read-only list containing the generic type arguments. Returns an empty list if the type is not generic.</returns>
52+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="type"/> is <c>null</c>.</exception>
53+
/// <example>
54+
/// <code>
55+
/// var genericTypes = "System.Collections.Generic.List&lt;System.String&gt;".GenericTypes();
56+
/// // Returns: ["System.String"]
57+
/// </code>
58+
/// </example>
3259
public static IReadOnlyList<string> GenericTypes(this string type)
3360
{
3461
ArgumentNullException.ThrowIfNull(type);
@@ -58,6 +85,18 @@ public static IReadOnlyList<string> GenericTypes(this string type)
5885
return types;
5986
}
6087

88+
/// <summary>
89+
/// Formats a type name for display in diagrams by removing namespace qualifiers and preserving generic type structure.
90+
/// </summary>
91+
/// <param name="type">The full type name to format.</param>
92+
/// <returns>A simplified type name suitable for diagram display.</returns>
93+
/// <exception cref="ArgumentNullException">Thrown when <paramref name="type"/> is <c>null</c>.</exception>
94+
/// <example>
95+
/// <code>
96+
/// var diagramName = "System.Collections.Generic.List&lt;System.String&gt;".ForDiagram();
97+
/// // Returns: "List&lt;String&gt;"
98+
/// </code>
99+
/// </example>
61100
public static string ForDiagram(this string type)
62101
{
63102
ArgumentNullException.ThrowIfNull(type);
@@ -78,6 +117,17 @@ public static string ForDiagram(this string type)
78117
}
79118
}
80119

120+
/// <summary>
121+
/// Converts a string to sentence case by adding spaces before uppercase letters and digits.
122+
/// </summary>
123+
/// <param name="type">The string to convert to sentence case.</param>
124+
/// <returns>The string converted to sentence case with appropriate spacing.</returns>
125+
/// <example>
126+
/// <code>
127+
/// var sentence = "MyPropertyName".ToSentenceCase();
128+
/// // Returns: "My Property Name"
129+
/// </code>
130+
/// </example>
81131
public static string ToSentenceCase(this string type)
82132
{
83133
if (string.IsNullOrEmpty(type))

0 commit comments

Comments
 (0)