Skip to content

Show jsdoc typedef details in suggestions / intelliSense #41096

Closed
@AoDev

Description

@AoDev

If a type is defined through typedef (given a name), then description / suggestions only show the name.
But to be useful, it should show the details of the type.

I'll make a code comparison and show the different results:

The variant I'd like to improve

We define a type through typedef

/**
 * @typedef {object} myOptions
 * @property {number} option1
 * @property {string} option2
 */

/**
 * @param {myOptions} options
 */
function doSomethingElse (options) {
  // ...
}

Hovering the function call will only give us the typedef name. We have no idea what the actual options are.

Screenshot 2020-10-04 at 12 08 33

I thought I could maybe ctrl/cmd click on the type name in the description to go to the definition, but nothing happens.

Same while typing, we have no information.

Screenshot 2020-10-04 at 12 09 19

Compare to inline jsdoc (best description result)

/**
 * @param {{option1: number, option2: string}} options
 */
function doSomething (options) {
  // ...
}

Hovering the function call, we have a nice description of the options argument.

Screenshot 2020-10-04 at 12 02 19

Same while typing, we have details about the options.
Screenshot 2020-10-04 at 12 02 48

Side note: strange that we don't have a nice syntax highlighting while typing, seems it would be easier to reuse the hovering logic and show the same thing.

Feature request

So, what I'd like is vscode to show the same thing for the @typedef case than for the inline jsdoc case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions