microsoft / microsoft/TypeScript

JSDoc @name tag does not function

Open
#31,622 2 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

  • VSCode Version: 1.33.1
  • OS Version: Windows 7 x86_64 (but I do not think that is relevant)
  • Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Write in a file with .js or .ts extension the below sample code:
/**
  Construct a new component

  @class Component
  @classdesc A generic component

  @param {Object} options - Options to initialize the component with
  @param {String} options.name - This component's name, sets {@link Component#lastProperty}
  @param {Boolean} options.visible - Whether this component is vislble, sets {@link Component#firstProperty}
*/
function Component(options) {
  /**
    Whether this component is visible or not

    @name Component#firstProperty
    @type Boolean
    @default false
  */
  this.firstProperty = options.visible;

  /**
    This component's name

    @name Component#lastProperty
    @type String
    @default "Component"
    @readonly
  */
  Object.defineProperty(this, 'lastProperty', {
    value: options.name || 'Component',
    writable: false
  });
}

const myComponent = new Component({});
  1. on a new line at the end of the document type myComponent with a dot at its end.
  2. While the text-cursor is after the dot, press Ctrl+Space to open the auto-completion list.

Current Behavior:

When you chose .js as file extension, only firstProperty is in the auto-completion list (with its type comment and so on).

But when you have it in a file with .ts extension, none of firstProperty and lastProperty will be detected, and JSDoc seems useless.

Expected Behavior:

Both firstProperty and lastProperty should be detected and get placed in the auto-completion list, and that no matter which of .js or .ts file extensions we are using.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied Component example in both .js and .ts files, then inspect the completion behavior after myComponent.. Compare which JSDoc-defined properties are detected in each file type; done means both firstProperty and lastProperty appear in completion lists for both extensions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.