sublime-jsdocs
sublime-jsdocs copied to clipboard
@return not being added sometimes in JavaScript
@return is only getting added sometimes. I can't figure out when it gets added and when it doesn't.
In this example the @return doesn't get added but I imagine it should. Am I missing something?
function add(param1, param2) {
return 1;
}
This is what gets generated.
/**
* [add description]
* @param {[type]} param1
* @param {[type]} param2
*/
function add(param1, param2) {
return 1;
}
Same in php with Sublime Text 2. Whats happens?
Ahh I see. From the docs:
DocBlockr will try to make an intelligent guess about the return value of the function.
- If the function name is or begins with "set" or "add", then no
@returnis inserted.- If the function name is or begins with "is" or "has", then it is assumed to return a Boolean.
The idea was that functions such as addFoo() usually don't return anything.
Could an setting be added to enable or disable DocBlockr from trying to make an intelligent guess?
Maybe:
{
// Indicates if functions with the provided prefixes will automatically not include a @return section.
// Possible values are: array, true, false
// If true, the default value will be: ["set", "add"]
"jsdocs_return_exclude_for_prefixes": ["set", "add"],
// Indicates if functions with the provided prefixes will automatically have the @return type as a Boolean.
// Possible values are: array, true, false
// If true, the default value will be: ["is", "has"]
"jsdocs_return_type_bool_for_prefixes": ["is", "has"],
}