Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Requiring @name property causes IDE bugs #112

@btesser

Description

@btesser

This is related to the fact that in the jsdoc standard, the @name property causes the parser to ignore the context that the item exists in. Here's a snippet from the jsdoc3 docs:

The @name tag forces JSDoc to associate the remainder of the JSDoc comment with the given name, ignoring all surrounding code - http://usejsdoc.org/tags-name.html

This causes issues in Webstorm, Phpstorm, Intelli-j, etc. which try to parse the jsdoc comment blocks. In particular, it is unable to locate methods on objects, properties, types, autocomplete, etc. The issues are fairly invasive. When the @name property is removed, this work perfectly fine.

I've come up with a few workarounds that help, but are all hacky.

  1. Prefixing the name with a colon (:) causes the ide to treat the item being documented differently, and recognizes the method better, but still not perfectly. For example:
/**
  * @ngdoc method
  * @name :myMethod
  */
  1. After the dgeni/ngdocs comment block add an additional /**/. This causes the name not to apply to the code below it, but then you lose the ide support of whatever type annotations and doc completion that was added. For example:
/**
 * @ngdoc method
 * @name myMethod
 *//**/

3, A combination of 1, 2, or both and adding the @Class tag with the name as the value. This helps the idea recognize that it is related somewhat.

You may feel that this is not an issue in dgeni, but since dgeni has a jsdoc package, and it is generally in line with the jsdoc standard, I believe that requiring a tag in an unorthodox way that breaks other jsdoc tools which conform to the standard is in fact an issue.

My suggested fix for this is to allow the use of an alias for name that would not get picked up by other tools... perhaps @DName or something like that (for dgeni-name)

Let me know your thoughts... I hope you take this seriously. This issue has been a major stumbling block for me as I find the IDE tools extremely valuable. This has also caused issues in code review with people asking why my hacky fixes are in there, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions