最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - JSDoc support in IntelliJ IDEA - Stack Overflow

programmeradmin3浏览0评论

Is there documentation for what JSDoc subset, superset, or mix of the two IntelliJ supports? My motivation for using JSDoc is two-fold:

  1. For developers: so IntelliJ can provide better code-completion, code checking, error checking, etc.
  2. For runtime efficiency: using the Closure compiler.

For #1 above, it is important for me to use JSDoc markup that is supported by IntelliJ, and until now figuring this out has mostly been a trial and error process.

Is there documentation for what JSDoc subset, superset, or mix of the two IntelliJ supports? My motivation for using JSDoc is two-fold:

  1. For developers: so IntelliJ can provide better code-completion, code checking, error checking, etc.
  2. For runtime efficiency: using the Closure compiler.

For #1 above, it is important for me to use JSDoc markup that is supported by IntelliJ, and until now figuring this out has mostly been a trial and error process.

Share Improve this question asked Nov 3, 2010 at 22:42 avernetavernet 31.7k47 gold badges132 silver badges166 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 9

Based on what little information is available in the WebStorm documentation, it looks like IntelliJ IDEA supports the entire JSDoc set. The only other note in the documentation is on viewing inline documentation which only points at the JSDoc SourceForge page.

It's been a bit trial and error, but I have finally been able to get decent results with it. I had especially trouble with getting inheritance for Backbone similar OO to work right. What I ended up doing was things like this:

/**
 * @class App.Views.ProductView
 * @extends App.Views.TemplateView
 **/
App.Views.ProductView = App.Views.TemplateView.extend(
  /** @lends App.Views.ProductView **/
  {  
      /**
       * @param {string} str
       * @return string[]
       **/
      method: function (str) {
           return [str, str];
     }
  };

You definitely have to help out a lot manually when inheritance is involved.

As far as I can tell, discrepancies were: you have to provide a name to @class, else it gets confused. @name seems to not work really well. The rest is decent, some of the tags are unused (@event, etc...).

The JSDoc support by IDEA / WebStorm is a standard feature nowadays, but with some IDE tuning it's possible to generate a JSDoc with one click.

The step-by-step guide how to enable a JSDoc generation in IDEA / WebStorm with the jsdoc npm module: How to generate JSDoc documentation in IntelliJ IDEA / WebStorm?

发布评论

评论列表(0)

  1. 暂无评论