在Intellij中自动完成@author [英] Autocompletion of @author in Intellij
问题描述
我正在从Eclipse迁移到Intellij Idea。我还想知道的一件事是自动完成 @author
JavaDoc标记。
在Eclipse中输入 @a
时,有两个提案:
I'm migrating from Eclipse to Intellij Idea. One thing I couldn't figure out yet is autocompletion of the @author
JavaDoc tag.
When typing @a
in Eclipse, there are two proposals:
@author - author name
@author
如何实现第一个提案在Intellij(甚至可能吗?)?如果可能的话,如何更改为作者姓名占位符插入的内容的模板?
How do I achieve the first proposal in Intellij (is it even possible?)? And if it's possible, how do I change the template of what is inserted for the author name placeholder?
推荐答案
你可以解决通过实时模板。
转到设置 - >实时模板,单击添加 - 按钮(右侧绿色加号)。
You can work around that via a Live Template. Go to Settings -> Live Template, click the "Add"-Button (green plus on the right).
在缩写字段中,输入应该激活模板的字符串(例如 @a
),并在模板文本区域输入要完成的字符串(例如 @author - 我的名字
)。将适用的上下文设置为Java(仅限注释)并设置完成的键(在右侧)。
In the "Abbreviation" field, enter the string that should activate the template (e.g. @a
), and in the "Template Text" area enter the string to complete (e.g. @author - My Name
). Set the "Applicable context" to Java (Comments only maybe) and set a key to complete (on the right).
我测试了它并且它工作正常,但IntelliJ似乎更喜欢inbuild模板,所以@a + Tab 只完成作者。但是,将完成键设置为 Space 。
I tested it and it works fine, however IntelliJ seems to prefer the inbuild templates, so "@a + Tab" only completes "author". Setting the completion key to Space worked however.
更改通过文件模板自动插入的用户名(创建类时为例如),可以通过添加来改变
To change the user name that is automatically inserted via the File Templates (when creating a class for example), can be changed by adding
-Duser.name =你的名字
到 IntelliJ / bin <中 idea.exe.vmoptions 或 idea64.exe.vmoptions (取决于您的版本) / em>目录。
to the idea.exe.vmoptions or idea64.exe.vmoptions (depending on your version) in the IntelliJ/bin directory.
这篇关于在Intellij中自动完成@author的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!