Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable user to use the plural form of @return #23

Closed
wants to merge 2 commits into from

Conversation

smt
Copy link

@smt smt commented Jun 3, 2015

My team prefers (and enforces) @returns, so here's a PR of my personal hack to enable a configurable variation of the @return tag output.

The @return tag remains the default unless the g:jsdoc_return_plural option is set to 1.

g:jsdoc_return_plural           *g:jsdoc_return_plural
        Use the `@returns` tag instead of `@return`.

        Default value is '0'

smt added 2 commits June 3, 2015 08:14
According to [@use JSDoc](http://usejsdoc.org/tags-returns.html), `@returns` is the actual tag name, and `@return` is a synonym.

Keep the existing default (`@return`), but allow user to specify a preference by setting `g:jsdoc_return_plural` to 1.
@ryanoasis
Copy link
Contributor

Seems like a good idea, especially since they are synonyms: http://usejsdoc.org/tags-returns.html

@smt
Copy link
Author

smt commented Jun 3, 2015

It's possible that other synonyms might have support added in the future as well, so with that in mind, the var could be refactored to g:jsdoc_return_synonym, etc.

@ryanoasis
Copy link
Contributor

@smt That is a good point. Maybe this is a good place to use dictionaries to logically group them as well. E.g.

g:jsdoc_tag_synonyms = {
  \  'return': 'returns',
  \  'description': 'desc',
  " etc...
\}

To let the user define override defaults

For reference here is the full list that have synonyms (from http://usejsdoc.org):

@abstract (synonyms: @virtual)
This member must be implemented (or overridden) by the inheritor.

@augments (synonyms: @extends)
Indicate that a symbol inherits from, ands adds to, a parent symbol.

@class (synonyms: @constructor)
This function is intended to be called with the "new" keyword.

@constant (synonyms: @const)
Document an object as a constant.

@default (synonyms: @defaultvalue)
Document the default value.

@description (synonyms: @desc)
Describe a symbol.

@external (synonyms: @host)
Identifies an external class, namespace, or module.

@file (synonyms: @fileoverview, @overview)
Describe a file.

@fires (synonyms: @emits)
Describe the events this method may fire.

@function (synonyms: @func, @method)
Describe a function or method.

@member (synonyms: @var)
Document a member.

@param (synonyms: @arg, @argument)
Document the parameter to a function.

@property (synonyms: @prop)
Document a property of an object.

@returns (synonyms: @return)
Document the return value of a function.

@throws (synonyms: @exception)
Describe what errors could be thrown.

{@link} (synonyms: {@linkcode}, {@linkplain})
Link to another item in the documentation.

@heavenshell
Copy link
Owner

Sorry for late response.

g:jsdoc_tag_synonyms = {
\ 'return': 'returns',
\ 'description': 'desc',
" etc...
}

I like this idea.
Pull requests are very welcome 😄

@smt
Copy link
Author

smt commented Jun 8, 2015

👍 I can give it a go sometime this week, if nobody else beats me to it.

I'm closing this PR, and will reference it in a new PR.

@smt smt closed this Jun 8, 2015
@heavenshell
Copy link
Owner

@smt thx. I'm looking forward to your PR 😄

@ryanoasis
Copy link
Contributor

👍

@ryanoasis
Copy link
Contributor

@smt Just curious if you still plan on doing this? 😄

@smt
Copy link
Author

smt commented Jun 29, 2015

@ryanoasis I got started on it, but didn't get very far before life got in the way. If you are game, feel free to grab this 😁

@ryanoasis
Copy link
Contributor

@smt Totally understand that! Maybe if I remember I will check in in another few weeks 😄

I wouldn't start on any work unless I checked with you (no need to duplicate effort 😃)

ryanoasis added a commit to ryanoasis/vim-jsdoc that referenced this pull request Dec 9, 2015
* currently for: @returns, @param, @function, @Class
* originally discussed on PR heavenshell#23 (... plural form of '@return')
* makes '@returns' the default per JSDoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants