heavenshell / vim-jsdoc

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

Arrow Functions Not Supported #37

Closed csaroff closed 9 years ago

csaroff commented 9 years ago

When attempting to document arrow functions I ran into this issue.

When I run :JsDoc on the following methods, the displayed JsDoc is generated.

/**
 *
 *
 * @return {undefined}
 */
const f = (arg1, arg2) => true;
/**
 * f
 *
 * @param arg1
 * @param arg2
 * @return {undefined}
 */
const f = function(arg1, arg2) {
    return true;
};

The arrow functions do not generate parameters or method names.

heavenshell commented 9 years ago

Currently arrow function does not work.

If you can't wait my update, patches are very welcome.

csaroff commented 9 years ago

Okay, thank you heavenshell. I'll take a look at it this weekend, but I'm not sure that I'll have time to commit a patch. I just wanted to add feature request, but I didn't know how to add the enhancement label. Thanks for all of your work. You're a hero!

heavenshell commented 9 years ago

@csaroff Try https://github.com/heavenshell/vim-jsdoc/tree/feature_arrow_function branch.

let g:jsdoc_enable_es6 = 1
/**
 * foo
 *
 * @param {number} arg1
 * @param {number} arg2
 * @return {undefined}
 */       
const foo = (arg1, arg2) => true;

/**
 * f
 *
 * @param {number} arg1
 * @return {undefined}
 */       
const f = arg1 => true;

I'm not familar to ES6. So please send me feed back if you have any problem.

jacoborus commented 9 years ago

New branch works perfect for me

heavenshell commented 9 years ago

Thanks. :+1:

heavenshell commented 9 years ago

Note From ver 0.5.0, g:jsdoc_allow_shorthand will be deprecated. Use let g:jsdoc_enable_es6 == 1 instead.

csaroff commented 9 years ago

Looks awesome man. Thank you sooo much!

heavenshell commented 9 years ago

@csaroff Thx, I'll merge to master.

heavenshell commented 9 years ago

Merged.

jacoborus commented 9 years ago

I just realized that this feature breaks shorthand methods option. I opened #38