How can I format the return
statement so that it also aligns to the same level as the parameter description (see the image below)
I'd like to have the second line of the return
statement at least aligned to the first line, in this particular case the word needed
should be aligned to the word Some
. I tried all settings in Settings -> Editor -> Code Style -> Java -> Tab "JavaDoc"
but did not find any setting for return
. This is the snippet of desired output:
/**
* Add 2 to x and multiplies the result with y.
*
* @param x X param.
* @param y Y param
*
* @return Some very long return description of the return statement even if it sometimes does not make sense but is
* needed to show the purpose of my question.
As you can see "needed" is exactly below "Some".
It seems like IntelliJ does not have the customisation option to specify the indentation style for the description of the @return
tag. However, this link shows that the issue has been identified in IntelliJ and is listed as a feature to be implemented in their backlog. A note from one of the developers:
Yaroslav Lepenkin 14 Jul 2016, 03:12 - currently it is not in the priority list, but I think I'll come up with some enhancements in 2016.3
It was raised as an issue in 2014 and the issue status recently changed from "To be discussed" to "Open", so hopefully it will be implemented in one of the next releases.
For now, although this is not the best solution, you can just tab indent each line of the description and use Ctrl + Alt + L to adjust the comment wrapping.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With