Skip to content

JSDoc render with @param Object properties #55258

@stormwind85

Description

@stormwind85

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version:
  • OS Version:

Steps to Reproduce:

  1. Go to vscode.dev
  2. Paste the following block of code
/**
 * @param {Object} options the args object
 * @param {number} options.alpha first number
 * @param {number} options.bravo second number
 * @param {Function} callback the callback function
 * @returns {number}
 */
function addNumbersFromObject(options, callback = null) {
    if (!callback) return options.alpha + options.bravo;
    return callback();
}
  1. Hover the name of the function addNumbersFromObject with your mouse and wait until JSDoc render is displayed

Expected:

The render should display the Object properties of options variable like the following image.

image

Actual:

The render does not display the Object properties of options variable.

Tricky solution:

Just replace the type of options variable in the JSDoc by any or * and it will display the Object properties in the render.

However, it will lose autocompletion inside code function when i'll try the access properties of options variable and I don't want to lose this feature.

In order to have autocompletion, we need to use Object type for options variable in JSDoc like the following image.

image

Recap:

I wish to have at the same time fully JSDoc and autocompletion on an Object variable where I know some of its properties.

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions