This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 249068 - Add support for JSDoc @typedef annotation
Summary: Add support for JSDoc @typedef annotation
Status: STARTED
Alias: None
Product: javascript
Classification: Unclassified
Component: Documentation (show other bugs)
Version: 8.0.1
Hardware: All All
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-02 14:16 UTC by brettryan
Modified: 2014-12-08 09:06 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description brettryan 2014-12-02 14:16:58 UTC
NetBeans presently provides really good support for the @param tag on function arguments. It would be great to be able to recognise @typedef types where they are able to be used in JSDoc, such as method arguments and variable declarations. Consider the following:

  /**
   * @typedef   MakeSelectWidgetArgs
   * @type      {object}
   * @property  {String} keyField
   *            Key field for property
   * @property  {String} [label]
   *            Label to add to select widget
   * @property  {(String|function|Array.<String>)} dataSource
   *            Source for option elements, may be: ...
   */

  /**
   * Make a select widget.
   *
   * @param   {MakeSelectWidgetArgs} opts
   *          Object containing properties to create widget for.
   */
  function makeSelectWidget(opts){
  }

Two very beneficial enhancements could be added.

  1. Provide links within documentation of makeSelectWidget code completion to link
     to the `MakeSelectWidgetArgs' type.
  2. Code documentation after the left brace of `makeSelectWidget({}' should show
     documentation to the types documentation.
  3. Any annotation of a variable declaration shall provide code completion to the
     properties defined within the @typedef type.

It would be acceptable to require types to have explicit @type annotation's, such as:

  /** @type {MakeSelectWidgetArgs} */
  var args = {};

  /* Or inline. */
  makeSelectWidget(/** @type {MakeSelectWidgetArgs} */ {
  });
Comment 1 Petr Pisl 2014-12-07 22:51:43 UTC
Some of these I have implemented in the web-main. Some part of the functionality is missing. Keep open.
Comment 2 brettryan 2014-12-08 02:37:54 UTC
Thats so cool Petr, thank you.