Skip to content

Parse generics in JSDoc @link symbol names #44818

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

Closed
mjbvz opened this issue Jun 29, 2021 · 1 comment · Fixed by #46450, TypescriptID/TypeScript#72 or GulajavaMinistudio/TypeScript#575
Closed
Assignees
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Jun 29, 2021

From microsoft/vscode#127557

Bug Report

🔎 Search Terms

  • JSdoc
  • @link
  • quickInfo

🕗 Version & Regression Information

4.3.4

Not a regression

💻 Code

class Foo<T> {
    /**
     * a {@link Foo}
     * 
     * b {@link Foo<T>}
     */
    bar(){}
}
  1. Hover over bar

🙁 Actual behavior

The {@link Foo<T>} link is not resolved correctly

🙂 Expected behavior

The link should be resolved the same way as the normal {@link Foo} link

Here's the compete response:

Trace  - 21:46:34.955] <semantic> Response received: quickinfo (188). Request took 1 ms. Success: true 
Result: {
    "kind": "method",
    "kindModifiers": "",
    "start": {
        "line": 7,
        "offset": 5
    },
    "end": {
        "line": 7,
        "offset": 8
    },
    "displayString": "(method) Foo<T>.bar(): void",
    "documentation": [
        {
            "text": "a ",
            "kind": "text"
        },
        {
            "text": "{@link ",
            "kind": "link"
        },
        {
            "text": "Foo",
            "kind": "linkName",
            "target": {
                "file": "/Users/matb/projects/san/x.ts",
                "start": {
                    "line": 1,
                    "offset": 1
                },
                "end": {
                    "line": 8,
                    "offset": 2
                }
            }
        },
        {
            "text": "}",
            "kind": "link"
        },
        {
            "text": "\n\nb ",
            "kind": "text"
        },
        {
            "text": "{@link ",
            "kind": "link"
        },
        {
            "text": "Foo",
            "kind": "linkName",
            "target": {
                "file": "/Users/matb/projects/san/x.ts",
                "start": {
                    "line": 1,
                    "offset": 1
                },
                "end": {
                    "line": 8,
                    "offset": 2
                }
            }
        },
        {
            "text": "<T>",
            "kind": "linkText"
        },
        {
            "text": "}",
            "kind": "link"
        }
    ],
    "tags": []
}
@andrewbranch andrewbranch added the Needs Investigation This issue needs a team member to investigate its status. label Jun 30, 2021
@andrewbranch andrewbranch added this to the TypeScript 4.5.0 milestone Jun 30, 2021
@sandersn
Copy link
Member

I don't think I understand the problem. Both links resolve successfully to the same location. The only difference is that the second link has trailing linkText: "<T>".

Do you want the same presentation change as () in #46428 to make <T> part of the linkName instead of linkText?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
4 participants