heavenshell / vim-jsdoc

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

Param defaults as optional? #64

Closed codeinabox closed 7 years ago

codeinabox commented 7 years ago

Using the ES6 code for handling defaults and :JsDoc with prompts enabled it generates the following

  /**
   * getChildren
   *
   * @param {int} id
   * @param {int} pageSize=10
   * @param {int} page=1
   * @returns {Promise}
   */
  getChildren(id, pageSize = 10, page = 1) {

However as per the JSDoc documentation, should those params with defaults be listed as optional? ie

  /**
   * getChildren
   *
   * @param {int} id
   * @param {int} [pageSize=10]
   * @param {int} [page=1]
   * @returns {Promise}
   */
  getChildren(id, pageSize = 10, page = 1) {
heavenshell commented 7 years ago

@codeinabox ah, thx for reporting issue.

I'll fix it later, stay tuned 😊

heavenshell commented 7 years ago

@codeinabox Could you try fix/default_params branch?

codeinabox commented 7 years ago

Still getting the same output

heavenshell commented 7 years ago

fmmm, strange.

/**
 * defaultParams
 *
 * @param {string} arg
 * @param {string} [arg1='foo']
 * @param {number} [arg2=100]
 * @returns {undefined}
 */

Could you show me your jsdoc.vim settings?

codeinabox commented 7 years ago

I tried that but get

/**
 * defaultParams
 *
 * @param {string} arg
 * @param {string} arg1='foo'
 * @param {string} arg2=100
 */
function defaultParams(arg, arg1 = 'foo', arg2 = 100) {}

Settings are

Plugin 'heavenshell/vim-jsdoc'
    " vim-jsdoc {{{
    let g:jsdoc_allow_input_prompt = 1
    let g:jsdoc_enable_es6 = 1
    " }}}
heavenshell commented 7 years ago

@codeinabox Thx. Did you try https://github.com/heavenshell/vim-jsdoc/tree/fix/default_params branch?

codeinabox commented 7 years ago

Yes. Went into .vim/bundle/vim-jsdoc and switched to that branch when I tried earlier.

heavenshell commented 7 years ago

@codeinabox Thx, I couldn't reproduced...

So, I add print debug statement. Update fix/default_params branch.

Run jsdoc and :messages. than, debug messages shows. Could you paste debug messages?

codeinabox commented 7 years ago

Nothing seems to come up when I invoke :messages

heavenshell commented 7 years ago

I think your plugin manager is something wrong. I don't know what plugin manager are you using.

Yes. Went into .vim/bundle/vim-jsdoc and switched to that branch when I tried earlier.

Is this right way to switch branch? I think you did not switch branch.

heavenshell commented 7 years ago

Merge to master.