Add type params for class documentation.#5
Open
Selectorsvt wants to merge 2 commits intop1va:mainfrom
Open
Conversation
added 2 commits
October 29, 2021 09:54
Contributor
Author
p1va
reviewed
Oct 30, 2021
Owner
p1va
left a comment
There was a problem hiding this comment.
Thank you for taking the time to improve this 🙏
I think we could reuse some of the existing configuration for this so that we gain template capability
Comment on lines
+356
to
+360
|
|
||
| /// <summary> | ||
| /// Gets or inits the value of include type parameters | ||
| /// </summary> | ||
| public bool IncludeTypeParams { get; init; } = true; |
Owner
There was a problem hiding this comment.
We could do something similar to what has been done for the MethodDocumentationOptions class here and add the ParamsDocumentationOptions options directly on the ClassDocumentationOptions like
public class ClassDocumentationOptions : MemberDocumentationOptionsBase
{
...
/// <summary>
/// Gets or sets the value of the type parameters
/// </summary>
public ParamsDocumentationOptions TypeParameters { get; set; } = new();
...
}
Comment on lines
+73
to
+82
| // If type params has to be included | ||
| if (_options.Summary.IncludeTypeParams) | ||
| { | ||
| var typeParams = SyntaxUtils | ||
| .ExtractTypeParams(node.TypeParameterList) | ||
| .Select(x => (x, string.Empty)) | ||
| .ToList(); | ||
|
|
||
| builder.WithTypeParams(typeParams); | ||
| } |
Owner
There was a problem hiding this comment.
If we go with the approach mentioned in the above comment this one could become
// If type params has to be included
if (_options.TypeParameters.Enabled)
{
// Extract type params and generate a description
var typeParams = SyntaxUtils
.ExtractTypeParams(node.TypeParameterList)
.Select(p => (p, _formatter
.FormatName(_options.TypeParameters.Template, (TemplateKeys.Name, p))));
builder.WithTypeParams(typeParams);
}
Owner
|
Is generating something like this what you are looking for? /// <summary>
/// The generic class
/// </summary>
/// <typeparam name="TResult">The result</typeparam>
public class GenericClass<TResult> where TResult : class
{
}
/// <summary>
/// The another generic class
/// </summary>
/// <typeparam name="TRequest">The request</typeparam>
/// <typeparam name="TResponse">The response</typeparam>
public class AnotherGenericClass<TRequest, TResponse>
{
} |
Contributor
Author
Yes. Thanks for fast respond |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.