Automatic Function Documentation Comments: use "return" instead of "returns"

Hi there,

I have a problem with the automatic function Documentation Comments.

[CODE]

/**
* Returns the sum of a and b
* @param {Number} a
* @param {Number} b
* @returns {Number}
*/
function sum(a, b) {
    return a + b;
}
[/CODE]

The default behaviour of the automation creates "@returns".

Is there a way to change it to "@return" without the "s"?
I couldn't find an answer..

I hope you can help!

Cheers!

6 comments
Comment actions Permalink

Hi Felix,

You did it as expected, but this functionality got broken in IDEA 15.0.1, and probably 15.0. It will be fixed in 15.1. For now, I may suggest to manually save the tag for generating comment by putting following line in options\options.xml stored in application config path.

<application>
  <component name="PropertiesComponent">
    <property name="javascript.return.tag" value="return" />

...
1
Comment actions Permalink

Why would you want to go against JSDoc specification?

0
Comment actions Permalink

Because I have to follow Google JavaScript Sytle Guide with ESLint.
ESLint complains each time it sees an @returns. and I have to change it manually.

0
Comment actions Permalink


Thanks for the link!

I think setting is too big for it, so I added some intelligence here. Last option selected in JSDoc tag completion will be used for generating comment. I.e. to switch to @return you should type "@retu" inside JSDoc, invoke completion and select the desired option.
Unfortunately, it's quite impossible to discover, but I have no idea how to do it better without introducing a new setting.



I could not get it to work.
If I type in /** before a function i get this:

/**
* @param {Number} a
* @param {Number} b
* @returns {Number}
*/


Then I remove "ns" from "@returns" so I got "@retur". I press Ctrl+Space to pop up "Completion" and select "return". If I understand the instruction right, the automation should now be set to use "@return", but it doesn't work.

Am I doing it wrong?

Update:
I'm using v15.01 btw. I see there is an update. I will give it a shot and see if it still won't work.

Update:
Still not working.

0
Comment actions Permalink

Works fine! Thanks! :)

0

Please sign in to leave a comment.