heavenshell / vim-jsdoc

Generate JSDoc to your JavaScript code.
BSD 3-Clause "New" or "Revised" License
452 stars 44 forks source link

No @return in JS #109

Closed akshat46 closed 3 years ago

akshat46 commented 3 years ago

I think this is currently the intended behavior? I saw similar stuff in the tutorial.

image

None of the functions have @return section but perhaps it should be added to the ones that do return something. If not by default, maybe there could be an option to include @return {} if functions is returning non null.

Sorry if this is already included. Didn't find anything in doc to change this behavior.

heavenshell commented 3 years ago

@akshat46 Thank you for using vim-jsdoc.

Yes, it's by design. If you using TypeScript or FlowType, you may add return type and would generate @returns

/**
 * setStart.
 *
 * @returns {Promis<any>}
 */
function setStart(): Promis<any> {}

If it's JavaScript, can't generate @return. Because parser(vim-jsdoc use) did not parse function body. (and I'm not changing the parser's behavior)

If you always want generate @return {} You can create your own template and set like following.

let g:jsdoc_templates_path = '/path/to/your/jsdoc_template.js'
akshat46 commented 3 years ago

I see. I'll just create a temple then. Thanks! Great project!