生成Kotlin方法/类注释 [英] Generating Kotlin method/class comments

查看:7058
本文介绍了生成Kotlin方法/类注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为您的方法/类生成注释?只需输入:

  / ** 

并且推入enter似乎在IntelliJ IDEA 2016.1.3中不起作用



似乎Dokka取代了KDoc,在IntelliJ中没有支持?



说明:在输入/ ** + enter时,会生成以下内容:



<$> p $ p> / **
*
* /

但我想知道为什么不生成@param和其他人(如IntelliJ对于Java)。这些注释也用于记录Kotlin代码( https://kotlinlang.org/docs/ reference / kotlin-doc.html

解决方案

@param 和其他标签不会生成,因为Kotlin推荐的文档样式是使用 [foo] 语法从doc注释文本中引用参数名称,而不是使用显式的 @param 标签记录它们。您可以查看 Kotlin标准库文档,了解如何使用此样式。


How do you generate comments for your methods/classes? Simply typing:

/**

And pushing enter does not seem to work in IntelliJ IDEA 2016.1.3

It seems like Dokka has superseded KDoc, but why is there no support in IntelliJ? Or am I missing something?

Clarification: when typing in /** + enter, this gets generated:

/**
 *
 */

But I'm wondering why the generation of @param and others aren't added (like IntelliJ does for Java). These annotations are used for documenting Kotlin code as well (https://kotlinlang.org/docs/reference/kotlin-doc.html)

解决方案

The @param and other tags are not generated because the recommended documentation style for Kotlin is to refer to parameter names from the doc comment text using the [foo] syntax, rather than to document them using explicit @param tags. You can check the Kotlin standard library documentation to see how this style is used.

这篇关于生成Kotlin方法/类注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆