diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index a68fdfcbfba..27d57464b5a 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -44,6 +44,8 @@ import { isIdentifier, isJSDoc, isJSDocParameterTag, + isJSDocPropertyLikeTag, + isJSDocTypeLiteral, isWhiteSpaceSingleLine, JSDoc, JSDocAugmentsTag, @@ -250,6 +252,12 @@ export function getJsDocTagsFromDeclarations(declarations?: Declaration[], check } for (const tag of tags) { infos.push({ name: tag.tagName.text, text: getCommentDisplayParts(tag, checker) }); + + if (isJSDocPropertyLikeTag(tag) && tag.isNameFirst && tag.typeExpression && isJSDocTypeLiteral(tag.typeExpression.type)) { + forEach(tag.typeExpression.type.jsDocPropertyTags, propTag => { + infos.push({ name: propTag.tagName.text, text: getCommentDisplayParts(propTag, checker) }); + }); + } } }); return infos; diff --git a/tests/baselines/reference/quickInfoJsDocTags12.baseline b/tests/baselines/reference/quickInfoJsDocTags12.baseline new file mode 100644 index 00000000000..35604c9a70f --- /dev/null +++ b/tests/baselines/reference/quickInfoJsDocTags12.baseline @@ -0,0 +1,189 @@ +=== /tests/cases/fourslash/quickInfoJsDocTags12.ts === +// /** +// * @param {Object} options the args object +// * @param {number} options.a first number +// * @param {number} options.b second number +// * @param {Function} callback the callback function +// * @returns {number} +// */ +// function f(options, callback = null) { +// ^ +// | ---------------------------------------------------------------------- +// | function f(options: any, callback?: any): void +// | @param options the args object +// | @param options.a first number +// | @param options.b second number +// | @param callback the callback function +// | @returns +// | ---------------------------------------------------------------------- +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoJsDocTags12.ts", + "position": 218, + "name": "" + }, + "item": { + "kind": "function", + "kindModifiers": "", + "textSpan": { + "start": 218, + "length": 1 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "options", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "callback", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "options", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the args object", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "options.a", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "first number", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "options.b", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "second number", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "callback", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "the callback function", + "kind": "text" + } + ] + }, + { + "name": "returns" + } + ] + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoJsDocTags12.ts b/tests/cases/fourslash/quickInfoJsDocTags12.ts new file mode 100644 index 00000000000..2511cc847fd --- /dev/null +++ b/tests/cases/fourslash/quickInfoJsDocTags12.ts @@ -0,0 +1,13 @@ +/// + +/////** +//// * @param {Object} options the args object +//// * @param {number} options.a first number +//// * @param {number} options.b second number +//// * @param {Function} callback the callback function +//// * @returns {number} +//// */ +////function /**/f(options, callback = null) { +////} + +verify.baselineQuickInfo();