microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.93k stars 12.47k forks source link

JSDoc doesn't show param info for parameter properties using @param #36356

Open DMCApps opened 4 years ago

DMCApps commented 4 years ago

TS Template added by @mjbvz

TypeScript Version: 3.8.0-beta

Search Terms


Steps to Reproduce:

  1. Create a function with a single parameter
  2. Add documentation to it with object parameter properties contained.
/**
 * Shows a dialog to the user with the given title, content, and performs the onAcceptClick
 * on the accept button press
 *
 * @param {Object} payload - The dialog information to show the user
 * @param {string} payload.title - Title of dialog
 * @param {string} payload.content - Content of the dialog
 * @param {string} [payload.acceptText=null] - Text shown on the accept button
 * @param {Function} [payload.onAcceptClick=null] - Action performed when accept is clicked
 * @param {string} [payload.cancelText=null] - Text shown on the cancel button
 * @param {Function} [payload.onCancelClick=null] - Action performed when cancel is clicked
 */
export const showDialog = (payload) => ({
  type: constants.UPDATE_DIALOG,
  payload,
})

All the parameters show for the method signatures but none of the inner parameter descriptions show. e.g. payload.cancelText does not show the text "Text shown on the cancel button" in the hover event dialog.

Sample

Note as well. Following the sytax defined here the default values do not show anywhere within the pop up. (I can make a separate issue if needed)

mjbvz commented 4 years ago

QuickInfo (hover) response:

[Trace  - 19:05:07.91] <semantic> Response received: quickinfo (141). Request took 3 ms. Success: true 
Result: {
    "kind": "const",
    "kindModifiers": "export",
    "start": {
        "line": 13,
        "offset": 14
    },
    "end": {
        "line": 13,
        "offset": 24
    },
    "displayString": "const showDialog: (payload: {\n    title: string;\n    content: string;\n    acceptText?: string;\n    onAcceptClick?: Function;\n    cancelText?: string;\n    onCancelClick?: Function;\n}) => {\n    type: any;\n    payload: {\n        title: string;\n        ... 4 more ...;\n        onCancelClick?: Function;\n    };\n}",
    "documentation": "Shows a dialog to the user with the given title, content, and performs the onAcceptClick\non the accept button press",
    "tags": [
        {
            "name": "param",
            "text": "payload - The dialog information to show the user"
        }
    ]
}
mjbvz commented 4 years ago

I believe the request here is to include the additional param tags in the tags part of the quickinfo response

DMCApps commented 4 years ago

@mjbvz There are 2 requests (The second one is just half mention in the last line cuz I wasn't sure if I should have made a separate ticket for it)

  1. To show the descriptions of the param.* values in the quick info.
  2. To show the set default value in the quick info as well (if possible in the description and the method signature)
thomas-ef commented 1 year ago

Is this still an issue ?

DMCApps commented 1 year ago

@thomas-ef This suggestion hasn't been implemented yet.

Method Definition

Screenshot 2023-05-26 at 09 41 13

The quick info

Screenshot 2023-05-26 at 09 41 23