Open lonix1 opened 2 years ago
Adding my vote.
But one cannot document that component itself. So we need this:
MyComponent.razor.cs
:/// <summary> /// Some documentation. /// </summary> public partial class MyComponent : ComponentBase { }
Just a side note, this documentation is not being displayed in the .razor file as well.
/// <summary>
/// Test documentation for the SurveyPrompt component
/// </summary>
public partial class SurveyPrompt
And also not in Intellisense.
Maybe this can be wrapped inside a @documentation
or @docs
block within the .razor
file.
I'm definitely suffering from this. Most components I write are a single .razor file, and therefore don't get a doc comment.
Same boat. So annoying when a codebase is shared among coworkers. How do the official Microsoft components do it?
How do the official Microsoft components do it?
Most of the components defined in the runtime are simply defined in a .cs file, and don't use a .razor file: https://github.com/dotnet/aspnetcore/blob/main/src/Components/Authorization/src/AuthorizeView.cs#L9
Alternatively those that do have .razor files would have a partial class in a .cs file and that specifies the documentation comment: https://github.com/dotnet/aspnetcore/blob/main/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs#L17
@davidwengier nice addition. When did this get added? This haven't work in the past.
I don't know, sorry.
@davidwengier Thank you for explaining that. Makes sense.
Would be nice to get to where we don't need that extra partial class, but it'll do for me now.
Maybe this can be wrapped inside a
@documentation
or@docs
block within the.razor
file.
I think this is the cleanest approach in keeping with the how .razor components without code-behind are structured. All that needs to happen is the content of that block in then converted into a /// summary at the top of the generated class.
Is your feature request related to a problem? Please describe.
It is convenient to specify both markup and code in a single
Foo.razor
file. However while it is possible to document the class' members, it's not possible to document the class itself.For example,
MyComponent.razor
:That member's documentation is recognised. But one cannot document that component itself. So we need this:
MyComponent.razor.cs
:Describe the solution you'd like
To be able to document the class in the same razor file.
e.g.
MyComponent.razor
:Applicable Scenarios
Blazor
Describe alternatives you've considered
A separate class. When there are many components, all those
.cs
files are just noise.Additional context
No.