Skip to content

@link jsdoc tags parse trailing parens as linkText  #44495

Closed
@mjbvz

Description

@mjbvz

From DefinitelyTyped/DefinitelyTyped#53629

Bug Report

🔎 Search Terms

  • jsdoc
  • @link

🕗 Version & Regression Information

TS 4.3.2

💻 Code

For the code

function foo(){}

/**
 * {@link foo()}
 */
const bar = 2
  1. Hover over bar

🙁 Actual behavior

The returned hover includes:

    "documentation": [
        {
            "text": "",
            "kind": "text"
        },
        {
            "text": "{@link ",
            "kind": "link"
        },
        {
            "text": "foo",
            "kind": "linkName",
            "target": {
                "file": "/Users/matb/projects/san/x.tsx",
                "start": {
                    "line": 1,
                    "offset": 1
                },
                "end": {
                    "line": 1,
                    "offset": 17
                }
            }
        },
        {
            "text": "()",
            "kind": "linkText"
        },
        {
            "text": "}",
            "kind": "link"
        }
    ],

Notice how the linkText is ()

🙂 Expected behavior

I'd expect this example to have no linkText as the () is part of the symbol name

Having trailing parens in a link in somewhat common in definitely typed (it occurs around 1000 times in my quick search) so we should likely support this case

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions