在 Kotlin 中记录 Class 属性
Documenting Class Properties in Kotlin
自从我从 Java 切换到 Kotlin 后,我不得不重写我的文档。 Kotlin 有自己的文档格式,或者据我所知它扩展了普通的 javadoc。我已经检查了 the official documentation,它指出有一个 property
标签允许您记录 类 属性。
如果我的 kdoc 看起来像这样:
/**
* 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
*/
这两个属性都不是 IntelliJ 中呈现的 kdoc 的一部分。
如果我将两个属性移动到 author
和 since
上方,它们也不会显示。我不太明白为什么。是 IntelliJ 缺少适当的 kdoc 支持吗?
正如 Java 的 IntelliJ 在您调用 class 上的 "Show quick documentation" 操作时不会向您显示 class 的所有字段的 javadoc,IntelliJ for Kotlin 不会将所有属性的文档显示为 class quickdoc 的一部分。如果您在 属性.
上调用 "Show quick documentation" 操作,将显示您在 @property
标签中添加的文档
自从我从 Java 切换到 Kotlin 后,我不得不重写我的文档。 Kotlin 有自己的文档格式,或者据我所知它扩展了普通的 javadoc。我已经检查了 the official documentation,它指出有一个 property
标签允许您记录 类 属性。
如果我的 kdoc 看起来像这样:
/**
* 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
*/
这两个属性都不是 IntelliJ 中呈现的 kdoc 的一部分。
如果我将两个属性移动到 author
和 since
上方,它们也不会显示。我不太明白为什么。是 IntelliJ 缺少适当的 kdoc 支持吗?
正如 Java 的 IntelliJ 在您调用 class 上的 "Show quick documentation" 操作时不会向您显示 class 的所有字段的 javadoc,IntelliJ for Kotlin 不会将所有属性的文档显示为 class quickdoc 的一部分。如果您在 属性.
上调用 "Show quick documentation" 操作,将显示您在@property
标签中添加的文档