Skip to content

Don't return tags when returning quick info for JSDoc nodes #59816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/services/symbolDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
isFunctionLike,
isIdentifier,
isInExpressionContext,
isInJSDoc,
isJsxOpeningLikeElement,
isLet,
isModuleWithStringLiteralName,
Expand Down Expand Up @@ -797,7 +798,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
}
}

if (tags.length === 0 && !hasMultipleSignatures) {
if (tags.length === 0 && !hasMultipleSignatures && !isInJSDoc(location)) {
tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker);
}

Expand Down
9 changes: 9 additions & 0 deletions tests/cases/fourslash/jsDocContextualTagsInJsDoc1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference path="fourslash.ts" />

//// /**
//// * @param x/*1*/ Does the thing
//// */
//// function foo(x/*2*/) {}

verify.quickInfoAt("1", "(parameter) x: any", "Does the thing", undefined);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implements the change described by @mjbvz here. Maybe some JSDoc tags should be returned when requesting quick info for a JSDoc node? I don't know when it would be desirable though. It seems that they always describe an associated node and not itself. The "itself" description gets still returned as part of the documentation string

verify.quickInfoAt("2", "(parameter) x: any", "Does the thing", [{ name: "param", text: "x Does the thing" }]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this isn't particularly desirable result either. It still contains duplicate information. I think this should be fixed as part of #57819 though and not here