Intellij 的 javadoc 自动生成
IntelliJ 有自动生成 Javadoc 的插件吗?示例 http://jautodoc.sourceforge.net/
Is there an automatic Javadoc generation plugin for IntelliJ? Example http://jautodoc.sourceforge.net/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Javadoc 生成(编写 .html 文件)是按需完成的(“工具”->“生成 Javadoc”),并且在您设置后基本上是自动的。生成 javadoc 存根(这就是 Eclipse 的 jautodoc 所做的事情)是逐个方法、逐个类完成的,并且仅在您指定的位置完成。
在方法签名上方键入
/**
将为您创建 Javadoc 存根。我怀疑你想要一些可以对整个文件、包或项目执行此操作的东西(例如 jautodoc)。曾经有这样一个插件: http://plugins.intellij.net/plugin/?id=952 但它不适用于 10。我不得不说这个 jautodoc 示例虽然是一个巧妙的聚会技巧,但却是我在 IDE 中见过的最无用的东西:它根据变量名称创建一个描述- 但前提是变量名称具有描述性,以至于一开始就不需要注释。
让你向往打孔卡。
Javadoc generation (writing the .html files) is done for you on-demand (Tools->Generate Javadoc) and is essentially automatic once you set it up. Generating javadoc stubs, which is what jautodoc for Eclipse does, is done method-by-method, class-by-class and only where you tell it to.
Typing
/** <enter>
above a method signature will create Javadoc stubs for you. I suspect you want something that will do this for an entire file, package or project though (like jautodoc). There used to be such a plugin: http://plugins.intellij.net/plugin/?id=952 but it won't work with 10.I do have to say that this jautodoc example, while a neat party trick, is the single most useless thing I've ever seen in an IDE: It creates a description based on the variable name - but only if the variable name is so descriptive that it doesn't need a comment in the first place.
Makes you yearn for punched card.
更新了 IntelliJ
2020.3
版本的答案(也适用于2019.2
)Ctrl
+Shift
+A
>插件
>市场
选项卡 > 搜索JavaDoc
(供应商:“Sergey Timofiychuk”)> 安装)并按照以下步骤操作(从步骤 2 开始)。
--先前的答案--
在
2018.2
版本的 IntelliJCtrl
+Shift
+A
>插件
>浏览存储库...
>JavaDoc2
)文件
>无效缓存/重新启动...
>只需重新启动
)Alt
+Shift
+G
。如果由于不同的键盘映射关联而不起作用,请尝试Alt
+Insert
并选择为所选元素创建 JavaDocs
Ctrl
+Alt
+Shift
+G
(或Alt
+Insert
并选择为所有元素创建 JavaDocs
)(需要注意的是,它仅为公共方法生成 javadoc,而不为字段和私有方法)
Updated the answer for
2020.3
version of IntelliJ (also works in2019.2
)Ctrl
+Shift
+A
>Plugins
>Marketplace
tab > search forJavaDoc
(by vendor: "Sergey Timofiychuk") > Install)and follow below steps (from Step 2).
--PREVIOUS ANSWER--
Tested below in
2018.2
version of IntelliJCtrl
+Shift
+A
>Plugins
>Browse Repositories...
>JavaDoc2
)File
>Invalid Caches/Restart...
>Just Restart
)Alt
+Shift
+G
. If this doesn't work due to different keymap association, tryAlt
+Insert
and selectingCreate JavaDocs for the selected element
Ctrl
+Alt
+Shift
+G
(orAlt
+Insert
and selectingCreate JavaDocs for all elements
)(One caveat is, it is generating javadoc only for public methods, not for fields and private methods)