From 58665cf3ae3a71f2db2bea61eeb5887dfa426839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Mon, 30 Jun 2025 22:20:08 +0200 Subject: [PATCH] Don't return `tags` when returning quick info for JSDoc nodes (#59816) --- src/services/symbolDisplay.ts | 3 ++- tests/cases/fourslash/jsDocContextualTagsInJsDoc1.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/jsDocContextualTagsInJsDoc1.ts diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index 83b9f302a9e..03b2b591936 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -50,6 +50,7 @@ import { isFunctionLike, isIdentifier, isInExpressionContext, + isInJSDoc, isJsxOpeningLikeElement, isLet, isModuleWithStringLiteralName, @@ -797,7 +798,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker( } } - if (tags.length === 0 && !hasMultipleSignatures) { + if (tags.length === 0 && !hasMultipleSignatures && !isInJSDoc(location)) { tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker); } diff --git a/tests/cases/fourslash/jsDocContextualTagsInJsDoc1.ts b/tests/cases/fourslash/jsDocContextualTagsInJsDoc1.ts new file mode 100644 index 00000000000..23ecdce7b33 --- /dev/null +++ b/tests/cases/fourslash/jsDocContextualTagsInJsDoc1.ts @@ -0,0 +1,9 @@ +/// + +//// /** +//// * @param x/*1*/ Does the thing +//// */ +//// function foo(x/*2*/) {} + +verify.quickInfoAt("1", "(parameter) x: any", "Does the thing", undefined); +verify.quickInfoAt("2", "(parameter) x: any", "Does the thing", [{ name: "param", text: "x Does the thing" }]);