Intellij 为方法和类生成 javadoc

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1843072/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 23:14:11  来源:igfitidea点击:

Intellij generate javadoc for methods and classes

javaintellij-ideajavadocauto-generate

提问by KarolDepka

Is it possible to set up Intellij to generate javadoc for methods and classes, automatically, with @author and @since date ?
I had this feature in Eclipse.
I know, that files have templates and also i can manually semi-automatically add javadoc to selected method/class. But i want the generation to be automatic for every generated method/class/enum/interface/field etc.
This is useful for e.g. "extract method", "override/implement", "create getter/setter" etc.
This would save hundreds of manual actions.
I'm using IntelliJ Idea 9.0 BETA Community Edition, #IC-90.96.
TIA.

是否可以将 Intellij 设置为使用 @author 和 @since date 自动生成方法和类的 javadoc ?
我在 Eclipse 中有这个功能。
我知道,这些文件有模板,而且我可以手动半自动地将 javadoc 添加到选定的方法/类。但我希望为每个生成的方法/类/枚举/接口/字段等自动生成。
这对于例如“提取方法”、“覆盖/实现”、“创建 getter/setter”等很有用。
这将节省数百的手动操作。
我正在使用 IntelliJ Idea 9.0 BETA 社区版,#IC-90.96。
TIA。

采纳答案by CrazyCoder

It's not possible at the moment. You may want to Vote for IDEABKL-1787.

目前是不可能的。您可能想为IDEABKL-1787投票。

回答by Alexey Shuk

There is JavaDoc Sync Plugin 8. http://plugins.intellij.net/plugin/?idea&id=3403Generates javadoc for all methods in class. Works in Idea 10.

有 JavaDoc Sync Plugin 8。http://plugins.intellij.net/plugin/?idea&id=3403为类中的所有方法生成 javadoc。适用于想法 10。

回答by rinkesh

for generate javadoc in intellij Idea go to Tools->Generate JavaDoc (4th option) click it and give path to save your Document

要在 intellij Idea 中生成 javadoc,请转到 Tools->Generate JavaDoc(第 4 个选项)单击它并给出保存文档的路径

回答by chance

For IntelliJ 12:

对于 IntelliJ 12:

Position caret above a method name, type /** and press Enter to let IntelliJ IDEA automatically generate JavaDoc stubs for this method. See here

将插入符号放在方法名称上方,键入 /** 并按 Enter 键,让 IntelliJ IDEA 自动为此方法生成 JavaDoc 存根。 看这里

回答by aelkz

For newer versions of IntelliJ (2018+), you can use this solution:

对于较新版本的 IntelliJ(2018+),您可以使用以下解决方案:

Typing /**+ then pressing Enterabove a method signature will create Javadoc stubs for you.

键入/**+ 然后按Enter上面的方法签名将为您创建 Javadoc 存根。

回答by Evvo

I have given up on hoping that IntelliJ will be able to do this. I now open my project in Eclipse, go to the desired files and invoke JAutoDoc.

我已经放弃希望 IntelliJ 能够做到这一点。我现在在 Eclipse 中打开我的项目,转到所需的文件并调用 JAutoDoc。

回答by Ivo Varbanov

An easy option is to access Find Actionmenu (Macs: Cmd+Shift+A| Win: Ctrl+Shift+A) and type any part of the Generate JavaDocaction. Once you found and clicked on that , an option menu for generation of JavaDocs is opened , containing a wide range of options and scopes.

一个简单的办法是访问查找操作菜单(Mac电脑:Cmd+ Shift+ A| WIN:Ctrl+ Shift+ A),然后键入的任何部位生成Javadoc行动。一旦您找到并单击它,就会打开一个用于生成 JavaDocs 的选项菜单,其中包含广泛的选项和范围。

Reference -> https://www.jetbrains.com/help/idea/mastering-keyboard-shortcuts.html

参考 -> https://www.jetbrains.com/help/idea/mastering-keyboard-shortcuts.html

回答by Ahmad Sajadian

Actually it's now possible, you can simply go to "Settings/Editor/File and Code Templates". There, you can edit the template which is used to create classes, enums, interfaces etc. My Intellij version is 2019.2.3 and on linux.

实际上现在可以了,您只需转到“设置/编辑器/文件和代码模板”即可。在那里,您可以编辑用于创建类、枚举、接口等的模板。我的 Intellij 版本是 2019.2.3,在 linux 上。