dokka icon indicating copy to clipboard operation
dokka copied to clipboard

Ambiguous link for properties from a primary constructor

Open vmishenev opened this issue 1 year ago • 4 comments

This example is from the Dokka unit test documented seealso with reference to property for class:

/**
* @see abc Comment to abc
*/
class Foo(val abc: String)

Here abc is a parameter and property. From the point of IDE view, the link [abc] leads to the same position in a source file independently of whether the abc is a parameter or property. From the point of generated documentation view, the link [abc] can lead to a parameter (currently, a constructor page) or a property page. In K1 @see abc always refers to the property Foo.abc. In K2 - to the parameter abc of constructor.


Proposal In KDoc there is the same way to assign documentation for a parameter and property from a constructor - only via block tags. So both links are possible.

/**
* @param abc parameter doc
* @property abc property doc
* @constructor some KDoc
*/
class Foo(val abc: String)

To keep a link to the parameter, [abc] should lead to a parameter but [Foo.abc] should lead to a property.

vmishenev avatar Sep 18 '23 18:09 vmishenev