Support "square bracket around @param name inside JSDoc for optional params" notation#446
Support "square bracket around @param name inside JSDoc for optional params" notation#446p-bakker wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
You have \s* inside of the parentheses for name[1], which makes comparing the group directly to [ will fail (unintentionally, it appears) when there's whitespace after the opening bracket.
There was a problem hiding this comment.
I'm trying to figure out in which scenario the regex would fail, but can't figure it out. All scenario's I test seem to work:
[name]
[name]
[ name]
[ name]
[name ]
[name ]
[ name ]
[ name ]
There was a problem hiding this comment.
This produces false:
/^\s*(\[?\s*)([^\]\s]+)\s*(\]?).*/.exec("[ name]")[1] == "["
So my impression is that your code doesn't actually add the question mark when there is whitespace after the [.
|
Fixed the anomaly |
|
Thanks. Merged as f127557 |
|
This is not working properly when using optional parameter and default value (the parameter is not displayed as optional) http://usejsdoc.org/tags-param.html Example of Problemhttp://ternjs.net/doc/demo.html Proper BehaviorMy Tern plugin modifies the contents of tooltips by re-parsing the jsdocs. I just upgraded to the latest Tern version which is why I found this issue as I had to update my re-parsing and matching with terns arg hints data due to the |
…ore default values Issue #446
|
Attached patch should fix the parsing of |



Implements #445