net_automatic_interface icon indicating copy to clipboard operation
net_automatic_interface copied to clipboard

Interfaces are created with "inheritdoc" xml comments

Open realbart opened this issue 1 year ago • 3 comments

As interfaces are typically at the top of the inheritance chain (interface -> abstract class -> concrete class) inheriting documentation does not make sense.

In manual code, inheritdoc is often used in the concrete class, but since we generate our interface, we put the xml documentation in the class itself. Inheriting bottom up does not work, so if you want to do anything with xml comments at all, I'd suggest you simply copy them.

realbart avatar Aug 12 '24 11:08 realbart

When I started this, i actually copied them. The problem is that it was diffcult to get the raw XML strings - I had only access to the parsed comments, and putting them into XML again is not trivial and error prone. I am open to suggestions

ChristianSauer avatar Aug 13 '24 06:08 ChristianSauer

I’ll see if I succeed in doing it myself. But as it is, I think no xml docs is better then inheritdoc.

realbart avatar Aug 13 '24 09:08 realbart

It should be possible to use inheritdoc with a specific cref like this to pull class comments onto the interface:

/// <inheritdoc cref="ClassName.MethodName{Generic1,Generic2}(Param1Type,Param2Type)"/>

It worked for this random method I tried it on in Rider. I don't know how hard it is to write as as source generator.

fjmorel avatar Aug 14 '24 13:08 fjmorel

It should be possible to use inheritdoc with a specific cref like this to pull class comments onto the interface:

/// <inheritdoc cref="ClassName.MethodName{Generic1,Generic2}(Param1Type,Param2Type)"/>

It worked for this random method I tried it on in Rider. I don't know how hard it is to write as as source generator.

@fjmorel This appears to work, at least for Jetbrains Rider. I have submitted a PR (#63) and my initial testing seems positive.

ChaseFlorell avatar Nov 04 '24 22:11 ChaseFlorell