Closed yuretz closed 8 years ago
Yeah actually I don't understand this redundant name strategy but I know it's supported so yeah I will try to edit by huge regex mess. :D
Thanks for your response. Well, this redundancy looks a bit ugly, I agree. But it could actually be useful for at least two things: recursion and readable stack traces, so I think it's a good thing to support anyway.
Hi again,
Well, it seems I found another case when those regexps are missing the function definition. Try annotating docTest()
in the following code:
function Constructor() {
this.docTest = function docTest(x, y) {
// something something
}
}
I'm just wondering, wouldn't it be OK to simplify those regular expressions and just search for simple function <name> ([<params>])
or something like this? I know, it will potentially allows people to insert function jsdoc comments in weird places, but they are able to do same thing manually anyway.
Probably, the best option would be to use the real javascript parser. It might of course sound like a bit like an overkill, but having a ready-made AST opens possibilities for some features that would be difficult to implement otherwise. And then you are sure to not miss anything. What do you think?
I thought about the parser option as well. Absolutely no idea how to use them :D I have some spare time the next days so I'll have a look but I probably need to replace a lot of code :D
If you try entering the following code
then, you will not be able to annotate the function
test()
automatically (neither keyboard shortcut, nor menu command works). But if you change the function tothen FuncDocr annotation works again.
Could the problem be in one of regular expressions?
Workaround for this issue is to wrap the declaration, so that
test:
part stays on its own line, then annotation works too.