21

I want to use style of JavaDoc:

/**
 * Description.
 *
 * @param param1     parameter description
 * @param param2     parameter description
 * @return           return description.
 * @throws exception exception description.
 */

How you can see I want to use align to right description of parameters, returns and exceptions.

This style used at http://www.oracle.com/technetwork/articles/java/index-137868.html

So, my question: how I can configured that style in IDEA 2016.x.x or how I can disable formatting for javaDoc without using specific comments //@formatter:off and //@formatter:on, if this possible?

Of course it's not serious and critical problem, but I am interest, because it's bad situation when developer can't set-up style by official documentation without any specific comment. I believe that i am wrong)

PS: I have tried off formatting at File->Settings->Editor->Code Style->Java->JavaDoc, Enable JavaDoc formatting to off (and playing with all settings at this section). And my alignment on JavaDoc resets on Ctrl-Alt-L

Thanks for feedback!

saw303
  • 8,051
  • 7
  • 50
  • 90
Alexey Nikitenko
  • 2,047
  • 2
  • 20
  • 30
  • 3
    I know it's not exactly your case, but if it's not the @param, etc. you can use html
     tags.  Otherwise, you could possibly build a plugin to specify that format.
    – Alessandro Scarlatti Nov 05 '17 at 02:50
  • Setting _File->Settings->Editor->Code Style->Java->JavaDoc, Enable JavaDoc formatting_ to off works well for me. I'm using version 2016.1.2 – eztam Nov 21 '17 at 16:06
  • 1
    Aleksey, did you figure out how to do this? I'm trying to do something similar, and it keeps making the Javadoc template for me, even after turning the setting off. – Ungeheuer Dec 08 '17 at 02:04

2 Answers2

3

Doesn't the "Align parameter descriptions" setting do this automatically? Screenshot right after applying setting

0

There are three plugins for intellij that might help:

  • auto-align
  • tabifier
  • String Manipulation

For me, the last one seems to be best suited. When I formet text, I select the part of the text I want to be formatted, right click -> String Manipulation -> Align -> Align to Column. Here, you have to experiment a little bit with the settings. It works for me.

See screenshot: enter image description here I added a space (the blue marker in the image) as a delimiter; selected a javadoc comment and used the above mentioned function. It works.

Walter Kuhn
  • 479
  • 1
  • 6
  • 19