Generate KDoc for methods in Android Studio [closed]

Since January 2019, there is a plugin on the Jetbrains website called kdoc-generator.

https://plugins.jetbrains.com/plugin/10389-kdoc-generator

Plugin to generate class and method KDoc.

This generator functions exactly like JavaDoc.
That means when you create a commentary with “/**” and press enter, the kdoc-generator creates automatically “@param” or “@return” tags for the parameter and return values of the method directly below this created commentary.

When you type /**
in your file above a method you wrote and then press enter you get something similar to this:

/**
 *
 * @param str 
 * @param age
 */
fun foo(str: String, age: Int) {

}

To install this Plugin directly in Android Studio:

  1. open File/Settings (Mac: AndroidStudio/Preferences)
  2. choose Plugins
  3. click Browse repositories…
  4. enter “kdoc-generator” in searchbar
  5. klick Install
  6. restart Android Studio
    Now the kdoc-generator is installed and you can use it directly.

Additionally Jetbrains developed a documentation engine for Kotlin, that you can use to convert your documentation in Kotlin files to some standard formats, e.g. HTML

https://github.com/Kotlin/dokka

Dokka is a documentation engine for Kotlin, performing the same function as javadoc for Java. Just like Kotlin itself, Dokka fully supports mixed-language Java/Kotlin projects. It understands standard Javadoc comments in Java files and KDoc comments in Kotlin files, and can generate documentation in multiple formats including standard Javadoc, HTML and Markdown.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)