Providing comments and annotations to your JavaScript code is a way to make it more definite and easier to read by other developers. It is especially important in large projects. Some static code analysis tools and verifiers take types and other information provided in JSDoc tags into consideration and report warnings if code is inconsistent with annotations. We suggest you as developers to developers to use annotations as much as possible.
JSDoc tags support in PhpStorm/WebStorm 5.0 has been improved to make your coding experience better. When something is known about current context, more relevant completion options will be shown and more static errors will be reported instantly. In the upcoming PhpStorm/WebStorm 5.0 EAP nearly all of Google Closure compiler JSDoc tags are supported. In addition to @param, @type, @extends etc., following tags will also be handled better:
@interface and @implements
When not all methods from interface are implemented, IDE will warn you about it and suggest to implement methods. Symbols from base interface will go to the completion list even if they are not implemented in a subclass (or IDE doesn’t see them to be implemented).
multiple inheritance
@typedef
@private and @protected
You should disable checkbox “Weaker type guess for completion” in Settings|JavaScript if you want symbols marked with @private and @protected tags to be removed from completion list in contexts where they are not accessible.
Also @enum, @override, @inheritDoc, @property, @lends, @constructs, @mixin and @mixes are supported now and completion, documentation lookup and parameter info take them into consideration.
You can already try all of described functionality in the latest EAP, so don’t hesitate to download it. Bug reports and suggestions are welcomed in our issue tracker.
Coming soon: enhanced Google Closure types syntax.
At last this feature ist implemented! Nice work!
This is the best news I’ve ever heard! I’m switching to EAP right now. And I hope all warnings in my current JsDocs will magically disapear. =)
Wow, thats great. Even though type inference and annotations for Google Closure works quite well in PhpStorm 4, further support is highly appreciated. Downloading 5.0 EAP right now …
Hooray for JSDoc !
Great!
Funny thing. I made a request on youtrack yesterday about support for this feature. I guess I have to read the development road map a bit better :)
Thanks all of you for kind words! If you are still encountering any issues, please report them, so we’ll fix them before release.
Well hot damn. That is just awesome! We use CC here, and getting official support for it in Storm is just awesome!
This is so cool!
Are there plans to implement the closure compiler type checking (e.g. error when calling a function that expects an int param with a string param instead)?
This is basically supported in 4.0 already. For example,
/** @param {number} i */
function f(i) {}
f("some text");
is producing a weak warning. Please ensure that inspection JavaScript|General|Type mismatch problem is enabled. If it still doesn’t work, please provide your code example here or in our tracker.
спасибо :)
It works sometimes. I’m having difficultly coming up with a reasonable-sized test case.
Er I guess “number” not “int.”
Will this work with loaded files from require.js?
Will this be included in IntelliJ also?
Yes, you can already explore it in the latest IDEA EAP.
Don’t forget @see!
I’m finding it really useful to mark up my code with the @see tag as a way to associate related classes and methods and navigate between them using Ctrl+Click.
What other useful tags are now supported?
I love this new feature!
Pingback: Scott Logic » TypeScript versus Closure
Pingback: WebStorm 6 EAP build 126.37 | WebStorm & PhpStorm Blog