Marcel
Marcel

Reputation: 1594

Documenting Class Properties in Kotlin

Since I switched from Java to Kotlin I had to rewrite my docs. Kotlin has its own documentation format or furthermore it extends normal javadocs as far as I see it. I have checked the official documentation which states that there is a property tag which allows you to document the classes properties.

If I have a kdoc looking like this:

/**
 * Tablemodel for the Players of a server, only holds two properties:
 *
 *  * Name
 *  * Score
 *
 * @author marcel
 * @since Jan 10, 2018
 * @property playerName Ingame name of the player
 * @property playerScore Ingame score of the player
 */

both properties are not part of the rendered kdoc in IntelliJ.

If I move the two properties above author and since, those will also not show. I don't quite understand why. Is it IntelliJ that is lacking proper kdoc support?

Upvotes: 1

Views: 2011

Answers (1)

yole
yole

Reputation: 97268

Just as IntelliJ for Java doesn't show you javadocs for all the fields of a class when you invoke the "Show quick documentation" action on the class, IntelliJ for Kotlin doesn't show docs for all properties as part of the class quickdoc. The docs you've added in @property tags will be shown if you invoke the "Show quick documentation" action on the property.

Upvotes: 6

Related Questions