Skip to content
Advertisement

How to make Intellij generate one-line comment for field instead of multi-lines?

When I Alt+Enter on private static final String FOO = "foo"; and select “Add Javadoc”, Intellij(version 2020.2) generate a multi-lines style comment like this.

    /**
     * blabla
     */
    private static final String FOO = "foo";

How do I make it generate one-line style comment instead?

    /** blabla */
    private static final String FOO = "foo";

Advertisement

Answer

There is no way to modify the formatting of the “Add Javadoc” intention AFAIK. You can just type the comment instead, since it’s just a few characters. Or you can create a Live Template (Preferences | Editor | Live Templates), to reduce the number of characters that is needed to type further. The Live Template could look something like this, for example:

/** $END$ */

Advertisement