简体   繁体   English

Intellij Idea可以一次为一个类的所有方法创建javadoc注释吗?

[英]Can Intellij Idea create javadoc comments for all the methods of a class at one time?

I know if I type /** at the top of a method, it will create the bare bones comment for that method, is there a way to do it for a whole class at one time? 我知道如果我在方法的顶部键入/ **,它将为该方法创建裸露的注释,有没有办法一次针对整个类呢? I tried the code menu, but did not see it. 我尝试了代码菜单,但没有看到它。

No, this feature is very intentionally not implemented. 不可以,此功能非常有意未实现。 JavaDoc comments that do not contain any meaningful information are useless, and auto-generating meaningful comments is impossible. 不包含任何有意义信息的JavaDoc注释是无用的,并且自动生成有意义的注释是不可能的。

A slightly quicker way is to set the action Fix doc comment to something like Alt + Shift + J (by default there is no keyboard shortcut). 一种更快的方法是将操作“ 修复文档注释”设置为Alt + Shift + J (默认情况下,没有键盘快捷键)。 Now if the cursor is anywhere in the method you can use this and it will generate the comments instead of having to be at the exact line. 现在,如果光标在方法中的任何位置,您都可以使用此方法,它将生成注释,而不必位于确切的行。

There may not be a default keystroke setup for this, so you can add it. 可能没有默认的按键设置,因此您可以添加它。 Go to IntelliJ preferences and type 'fix doc comment' into the search bar. 转到IntelliJ首选项,然后在搜索栏中输入“修复文档注释”。

InteliJ Keymap编辑器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM